Easiest Database Ever

Try it now

var gun = Gun('https://gunjs.herokuapp.com/gun');
gun.put({hello: "world"}).key('example/tutorial');
In this 1 minute tutorial, we will connect to a gun peer, create an object, and sync data in realtime.
var ref = gun.get('example/tutorial');
ref.on(function(data){
  $('body').text(JSON.stringify(data));
});
Congratulations! You just made an object and saved a reference to it. In two tabs, we'll load that key to open a shared reference.
https://gunjs.herokuapp.com/ x
https://gunjs.herokuapp.com/ x
ref.path('').put("");
Let's update the "hello" field with a different value. We can path into any field, and update it directly.

Realtime

It may be trivial to get realtime updates with socket.io or something, but what you do not get is state synchronization. GUN does this for you out of the box, assuring that two users' simultaneous updates won't concurrently break each other.

Distributed

GUN is peer-to-peer by design, meaning you have no centralized database server to maintain or that could crash. This lets you sleep through the night without worrying about database DevOps - we call this "NoDB". From that, you can build decentralized, federated, or centralized apps.

Offline-first

GUN works even if your internet or cell reception doesn't. Users can still plug away and save data as normal, and then when the network comes back online GUN will automatically synchronize all the changes and handle any conflicts for you.

Graph

Most databases force you to bend over backwards to match their storage constraints. But graphs are different, they let you have any data structure you want. Whether that be traditional tables with relations, document oriented trees, or tons of circular references. You choose.

Community

Are you currently working on a project using GUN or perhaps you would like more information before you make up your mind.

We always love to be in touch with our community and listen about what you're working on and maybe we can give you a hand. Click the button below and talk to us on Gitter!

API

Gun constructor

Used to creates a new gun database instance.

Read more

gun.put

Save data into gun, syncing it with your connected peers.

Read more

gun.key

Index your data, so you can find it later, faster.

Read more

gun.get

Load all data under a key into the context.

Read more

gun.path

Navigate through a node's properties

Read more

gun.back

Move up to the parent context on the chain.

Read more

gun.on

Subscribe to realtime updated changes on a node or property.

Read more

gun.map

Loop over each property in a node, and subscribe to future changes. It's essentially performing a .path on each field.

Read more

gun.val

Read a full object without subscribing updates.

Read more

gun.not

Handle cases where data can't be found.

Read more

Interactive explainers

Database can be scary, which is why we are making a series of explainers to educate everyone. Young or old, our goal is to show you that these ideas are actually simple.

Projects

Our GUN community is working on great projects here are the promising ones.

Resources