The database for
freedom fighters

Get started

Get ready to disrupt Big Tech

GUN gives you the most powerful weapons of the internet — and — to reclaim the web and make it truly free and open.

Powerful and flexible

GUN is a data­base en­gine that runs every­where JavaScript does — browsers, mo­bile de­vices and servers, al­low­ing you to build ex­act­ly the data sys­tem you want.

20 Million monthly downloads

GUN is pow­er­ing de­cen­tral­ized plat­forms with mil­lions of users and vast­ly dif­fer­ent re­quire­ments on a shoe­string bud­get.

GUN in 5 minutes

(click the boxes to copy the text)
  1. Add the GUN library. GUN runs in browsers, in Node.js, Elec­tron, and even Re­act Na­tive. In­stall it from npm, use a CDN, or down­load it here.

    <!-- To get going, add GUN to your website from a CDN -->
    <script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
  2. Play around with your data. GUN's core API is de­lib­er­ate­ly small but pow­er­ful. For more, check out GUN's many use­ful ex­ten­sions or ex­plore its wider ecosys­tem

    As an ex­am­­ple, run the fol­low­ing snip­pets in the con­­soles of two sep­a­rate tabs or browsers:

    // Connect to as many peers as you want
    const gun = Gun({ peers: ['http://localhost:8765/gun', 'http://gunjs.herokuapp.com/gun'] })
    
    // Then make the browser regularly update the db
    setInterval(() => {
      gun.get('bob').get('heartbeat').put(Date.now())
    }, 1000)
    // Browsers will discover each other automatically through one of the many peers
    const gun = Gun({ peers: ['http://localhost:8765/gun', 'http://gunjs.herokuapp.com/gun'] })
    
    // And listen to the heartbeat updates in real-time
    gun.get('bob').get('heartbeat').on(heartbeat => {
      const diff = Date.now() - heartbeat
      console.log(`Bob's heartbeat traveled ${diff} ms`)
    })
  3. Run a GUN relay. (op­tion­al) A re­lay can run on your lap­top or in the cloud, they are used as fall­backs when We­bRTC fails. You can de­ploy one to heroku, spin it up in dock­er, use the node.js API di­rect­ly, or start one with GUN's cli like this:

    #  Assuming you have node.js and npm installed, run this in your command line
    npx gun-cli --host 127.0.0.1

Nice, right?

But we've bare­ly scratched the sur­face. Start the tu­to­r­i­al or check out the doc­u­men­ta­tion to see what else you can do with GUN!