The database for
freedom fighters
Get startedGet 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 database engine that runs everywhere JavaScript does — browsers, mobile devices and servers, allowing you to build exactly the data system you want.
20 Million monthly downloads
GUN is powering decentralized platforms with millions of users and vastly different requirements on a shoestring budget.
Decentralized auth built-in
GUN's security module is built on strong encryption standards and works completely decentralized. In other words — real privacy with no single point of failure.
Graph data for the win
GUN's graph data model allows you to use intuitive data structures and queries, while still being capable of doing 20M+ API ops/sec in just ~9KB gzipped size.
Respond in real-time
Any remote updates to the data you subscribe to will be automatically propagated through the network, so you can react to changes as they happen.
GUN in 5 minutes
Add the GUN library. GUN runs in browsers, in Node.js, Electron, and even React Native. Install it from npm, use a CDN, or download it here.
<!-- To get going, add GUN to your website from a CDN --> <script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
Play around with your data. GUN's core API is deliberately small but powerful. For more, check out GUN's many useful extensions or explore its wider ecosystem
As an example, run the following snippets in the consoles of two separate 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`) })
Run a GUN relay. (optional) A relay can run on your laptop or in the cloud, they are used as fallbacks when WebRTC fails. You can deploy one to heroku, spin it up in docker, use the node.js API directly, 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 barely scratched the surface. Start the tutorial or check out the documentation to see what else you can do with GUN!