A realtime, decentralized, offline-first, graph database engine.
Clone or download
amark Merge pull request #625 from langholz/sea-keyid-fix
Fix SEA sha1hash for ossl and keyid
Latest commit 857149a Oct 11, 2018
Failed to load latest commit information.
examples get rid of tmp Sep 25, 2018
hooks Made the Docker Hub Automated build hook usable offline via 'npm docker' Dec 1, 2016
lib Add les.js (Memory Evict) Sep 26, 2018
sea Fix SEA sha1hash for ossl and keyid Oct 11, 2018
src unbuild Stabilized against V8 Fatalities. Sep 25, 2018
test Fix SEA sha1hash for ossl and keyid Oct 11, 2018
.dockerignore * Sanitized /examples dependency management Nov 12, 2016
.gitignore Minor modification to support browser storage better in NodeJS/testing Sep 29, 2017
.travis.yml Merge branch 'master' into chore/cache-node-modules Jul 3, 2018
CHANGELOG.md Update CHANGELOG.md Nov 21, 2017
Dockerfile CHANGE DEFAULT PORT TO 8765 Jul 30, 2018
LICENSE.md chore(license): Adding triple license Mar 19, 2015
Procfile Update Procfile Jul 18, 2018
README.md Update README.md Sep 27, 2018
app.json BasicDocker Button deployment with template app.json file Dec 3, 2016
as.js Couple more SEA fixes Aug 30, 2018
bower.json fix path, map, set, load, load, ws & escape todo + bump Feb 26, 2015
gun.js Stabilize against V8 fatalities. Sep 25, 2018
gun.min.js unbuild Stabilized against V8 Fatalities. Sep 25, 2018
index.js Massive directory cleanup, more reliable transport Dec 6, 2014
nts.js at.NTS never been found Oct 9, 2018
package-lock.json unbuild Stabilized against V8 Fatalities. Sep 25, 2018
package.json unbuild Stabilized against V8 Fatalities. Sep 25, 2018
sea.js Fix SEA sha1hash for ossl and keyid Oct 11, 2018


npm Travis FOSSA Status Gitter

GUN is an ecosystem of tools that let you build tomorrow's dApps, today.

Decentralized alternatives to Reddit, YouTube, Wikipedia, etc. are already pushing terabytes of daily P2P traffic on GUN. We are a friendly community creating a free fun future for freedom:

The ecosystem is one nice stack of technologies that looks like this:

For now, it is best to start with GUN and just use it to learn the basics, since it is so easy: (or want to read more? Skip ahead to the "What is GUN?" section.)


  • Try the interactive tutorial in the browser (5min ~ average developer).
  • Or npm install gun and run the examples with cd node_modules/gun && npm start (5min ~ average developer).

Note: If you don't have node or npm, read this first. If the npm command line didn't work, you may need to mkdir node_modules first or use sudo.

<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
// var Gun = require('gun'); // in NodeJS
// var Gun = require('gun/gun'); // in React
var gun = Gun();

  name: "Mark",
  email: "mark@gunDB.io",

gun.get('mark').on(function(data, key){
  console.log("update:", data);
  • Or try something mind blowing, like saving circular references to a table of documents! (play)
var cat = {name: "Fluffy", species: "kitty"};
var mark = {boss: cat};
cat.slave = mark;

// partial updates merge with existing data!

// access the data as if it is a document.
gun.get('mark').get('boss').get('name').once(function(data, key){
  // `val` 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 slave!", data);

// add both of them to a table!

// 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: "scare cat"});

Want to keep building more? Jump to THE DOCUMENTATION!

What is GUN?

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. :)

On that note, let's get some official shout outs covered first:


Thanks to:
Robert Heessels, Lorenzo Mangani, NLnet Foundation, Sam Liu, Daniel Dombrowsky, Vincent Woo, AJ ONeal, Bill Ottman, Mike Lange, Sean Matheson, Alan Mimms, Dário Freire, John Williamson


GUN was created by Mark Nadal in 2014 after he had spent 4 years trying to get his collaborative web app to scale up with traditional databases.

After he realized Master-Slave database architecture causes one big bottleneck, he (as a complete newbie outsider) naively decided to question the status quo and shake things up with controversial, heretical, and contrarian experiments:

The NoDB - no master, no servers, no "single source of truth", not built with a real programming language or real hardware, no DevOps, no locking, not just SQL or NoSQL but both (all - graphs, documents, tables, key/value).

The goal was to build a P2P database that could survive living inside any browser, and could correctly sync data between any device after assuming any offline-first activity.

Technically, GUN is a graph synchronization protocol with a lightweight embedded engine, capable of doing 20M+ API ops/sec in just ~9KB gzipped size.


API reference





React Native




CAP Theorem Tradeoffs

How Data Sync Works

How GUN is Built

Crypto Auth



This would not be possible without community contributors, big shout out to:

anywhichway (Block Storage); beebase (Quasar); BrockAtkinson (brunch config); Brysgo (GraphQL); d3x0r (SQLite); forrestjt (file.js); hillct (Docker); JosePedroDias (graph visualizer); JuniperChicago (cycle.js bindings); jveres (todoMVC); kristianmandrup (edge); Lightnet (Awesome Vue User Examples & User Kitchen Sink Playground); lmangani (Cytoscape Visualizer, Cassandra, Fastify, LetsEncrypt); mhelander (SEA); omarzion (Sticky Note App); PsychoLlama (LevelDB); RangerMauve (schema); robertheessels (gun-p2p-auth); sbeleidy; Sean Matheson (Observable/RxJS/Most.js bindings); Stefdv (Polymer/web components); sjones6 (Flint); zrrrzzt (JWT Auth); 88dev (Database Viewer);

I am missing many others, apologies, will be adding them soon!


To quickly spin up a Gun test server for your development team, utilize either Heroku or Docker or any variant thereof Dokku, Flynn.io, now.sh, etc. !




git clone https://github.com/amark/gun.git
cd gun
heroku create
git push -f heroku HEAD:master

Then visit the URL in the output of the 'heroku create' step, in a browser.


npm install -g now
now --npm amark/gun

Then visit the URL in the output of the 'now --npm' step, in your browser.


Docker Automated buil Docker Pulls Docker Stars

Pull from the Docker Hub . Or:

docker run -p 8765:8765 gundb/gun

Or build the Docker image locally:

git clone https://github.com/amark/gun.git
cd gun
docker build -t myrepo/gundb:v1 .
docker run -p 8765:8765 myrepo/gundb:v1

Or, if you prefer your Docker image with metadata labels (Linux/Mac only):

npm run docker
docker run -p 8765:8765 username/gun:git

Then visit http://localhost:8765 in your browser.


Designed with ♥ by Mark Nadal, the GUN team, and many amazing contributors.

Openly licensed under Zlib / MIT / Apache 2.0.

FOSSA Status

YouTube . Twitter