Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Install / Use
/learn @amark/GunREADME
GUN is an ecosystem of tools that let you build community run and encrypted applications - like an Open Source Firebase or a Decentralized Dropbox.
The Internet Archive and 100s of other apps run GUN in-production.
- Multiplayer by default with realtime p2p state synchronization!
- Graph data lets you use key/value, tables, documents, videos, & more!
- Local-first, offline, and decentralized with end-to-end encryption.
Decentralized alternatives to Zoom, Reddit, Instagram, Slack, YouTube, Stripe, Wikipedia, Facebook Horizon and more have already pushed terabytes of daily P2P traffic on GUN. We are a friendly community creating a free fun future for freedom:
<table> <tr> <a href="https://youtu.be/s_m16-w6bBI"><img width="31%" src="https://gun.eco/see/3dvr.gif" title="3D VR"/></a> <a href="https://github.com/cstefanache/cstefanache.github.io/blob/06697003449e4fc531fd32ee068bab532976f47b/_posts/2016-08-02-gun-db-artificial-knowledge-sharing.md"><img width="31%" src="https://gun.eco/see/aiml.gif" title="AI/ML"/></a> <a href="http://gps.gunDB.io/"><img width="31%" src="https://gun.eco/see/gps.gif" title="GPS"/></a> </tr> <tr> <a href="https://github.com/lmangani/gun-scape#gun-scape"><img width="31%" src="https://gun.eco/see/dataviz.gif" title="Data Viz"/></a> <a href="https://github.com/amark/gun/wiki/Auth"><img width="31%" src="https://gun.eco/see/p2p.gif" title="P2P"/></a> <a href="https://github.com/Stefdv/gun-ui-lcd#okay-what-about-gundb-"><img width="31%" src="https://gun.eco/see/iot.gif" title="IoT"/></a> </tr> <tr> <a href="http://chat.gun.eco"><img width="31%" src="https://gun.eco/see/vr-world.gif" title="VR World"/></a> <a href="https://youtu.be/1ASrmQ-CwX4"><img width="31%" src="https://gun.eco/see/ar.gif" title="AR"/></a> <a href="https://meething.space/"><img width="31%" src="https://gun.eco/see/video-conf.gif" title="Video Confernece"/></a> </tr> </table>Quickstart
GUN is super easy to get started with:
- Try the interactive tutorial in the browser (5min ~ average developer).
- Or
npm install gunand run the examples withcd node_modules/gun && npm start(5min ~ average developer).
Note: If you don't have node or npm, read this first. If the
npmcommand line didn't work, you may need tomkdir node_modulesfirst or usesudo.
- An online demo of the examples are available here: http://try.axe.eco/
- Or write a quick app: (try now in a playground)
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script>
// import GUN from 'gun'; // in ESM
// GUN = require('gun'); // in NodeJS
// GUN = require('gun/gun'); // in React
gun = GUN();
gun.get('mark').put({
name: "Mark",
email: "mark@gun.eco",
});
gun.get('mark').on((data, key) => {
console.log("realtime updates:", data);
});
setInterval(() => { gun.get('mark').get('live').put(Math.random()) }, 9);
</script>
- Or try something mind blowing, like saving circular references to a table of documents! (play)
cat = {name: "Fluffy", species: "kitty"};
mark = {boss: cat};
cat.slave = mark;
// partial updates merge with existing data!
gun.get('mark').put(mark);
// access the data as if it is a document.
gun.get('mark').get('boss').get('name').once(function(data, key){
// `once` grabs the data once, no subscriptions.
console.log("Mark's boss is", data);
});
// traverse a graph of circular references!
gun.get('mark').get('boss').get('slave').once(function(data, key){
console.log("Mark is the cat's slave!", data);
});
// add both of them to a table!
gun.get('list').set(gun.get('mark').get('boss'));
gun.get('list').set(gun.get('mark'));
// grab each item once from the table, continuously:
gun.get('list').map().once(function(data, key){
console.log("Item:", data);
});
// live update the table!
gun.get('list').set({type: "cucumber", goal: "jumping cat"});
Want to keep building more? Jump to THE DOCUMENTATION!
About
First & foremost, GUN is a community of the nicest and most helpful people out there. So I want to invite you to come tell us about what you are working on & wanting to build (new or old school alike! Just be nice as well.) and ask us your questions directly. :)
<p align="center"><a href="https://www.youtube.com/watch?v=oTQXzhm8w_8"><img width="250" src="https://img.youtube.com/vi/oTQXzhm8w_8/0.jpg"><br/>Watch the 100 second intro!</a></p>The GUN ecosystem stack is a collection of independent and modular tools covering everything from CRDT conflict resolution, cryptographic security & encryption, radix storage serialization, mesh networking & routing algorithms, to distributed systems correctness & load testing, CPU scheduled JSON parser to prevent UI lag, and more!
<div><img width="48%" src="https://gun.eco/see/stack.png"/> <img width="48%" align="right" src="https://gun.eco/see/layers.png"/></div>On that note, let's get some official shout outs covered first:
Support
<p align="center"> Thanks to: <table> <tr> <td vlign="center"><a href="https://mozilla.org/builders"><img height="100" src="https://user-images.githubusercontent.com/1423657/81992335-85346480-9643-11ea-8754-8275e98e06bc.png"></a></td> <td vlign="center"><a href="http://unstoppabledomains.com/"><img src="https://gun.eco/img/unstoppable.png"></a></td> <td vlign="center"><a href="https://mask.io/"><img src="https://dimensiondev.github.io/Mask-VI/assets/Logo/MB--Logo--CombH-Circle--Blue.svg" width="250"></a></td> </tr> <tr> <td vlign="center"> <a href="https://www.ajar.org/"><img src="https://www.ajar.org/logo.png" height="120"></a></td> <td vlign="center"><a href="https://wallie.io/"><img src="https://raw.githubusercontent.com/gundb/gun-site/master/img/wallie.png" width="250"></a></td> <td vlign="center"> <a href="https://ghostdrive.com/"><img src="https://gun.eco/img/ghostdrive.png" height="120"></a></td> </tr> </table><a href="https://github.com/robertheessels">Robert Heessels</a>, <a href="http://qxip.net/">Lorenzo Mangani</a>, <a href="https://nlnet.nl/">NLnet Foundation</a>, <a href="http://github.com/samliu">Sam Liu</a>, <a href="http://github.com/ddombrow">Daniel Dombrowsky</a>, <a href="http://github.com/vincentwoo">Vincent Woo</a>, <a href="http://github.com/coolaj86">AJ ONeal</a>, <a href="http://github.com/ottman">Bill Ottman</a>, <a href="http://github.com/mikewlange">Mike Lange</a>, <a href="http://github.com/ctrlplusb">Sean Matheson</a>, <a href="http://github.com/alanmimms">Alan Mimms</a>, <a href="https://github.com/dfreire">Dário Freire</a>, <a href="http://github.com/velua">John Williamson</a>, <a href="http://github.com/finwo">Robin Bron</a>, <a href="http://github.com/ElieMakhoul">Elie Makhoul</a>, <a href="http://github.com/mikestaub">Mike Staub</a>, <a href="http://github.com/bmatusiak">Bradley Matusiak</a>, <a href="https://github.com/sjuxax">Jeff Cook</a>, <a href="https://github.com/nmauersberg">Nico</a>, <a href="https://github.com/ajartille">Aaron Artille</a>, <a href="https://github.com/timjrobinson">Tim Robinson</a>, <a href="https://github.com/hibas123">Fabian Stamm</a>, <a href="https://twitter.com/mikestaub">Mike Staub</a>, <a href="https://hunterowens.com/">Hunter Owens</a>, <a href="https://github.com/JacobMillner">Jacob Millner</a>, <a href="https://github.com/b-lack">Gerrit Balindt</a>, <a href="https://github.com/gabriellemon">Gabriel Lemon</a>, <a href="https://github.com/murageyun">Murage Martin</a>, <a href="https://github.com/octalmage">Jason Stallings</a>
</p>- Join others in sponsoring code: https://www.patreon.com/gunDB !
- Ask questions: http://stackoverflow.com/questions/tagged/gun ?
- Found a bug? Report at: https://github.com/amark/gun/issues ;
- Need help? Chat with us: http://chat.gun.eco .
History
GUN was created by Mark Nadal in 2014 after he had spent 4 years trying to get his colla
