A local-first, reactive NoSQL database for JavaScript apps that runs in browsers, Node.js, React Native and Electron, with replication to your own backend.
amark/gun
A JavaScript graph-sync engine and toolkit for building decentralized, offline-first, end-to-end encrypted apps that sync peer to peer.
Open-source alternative to:Firebase
- Stars
- 19,149
- Forks
- 1,241
- Open issues
- 317
- Last commit
- 7 days ago
What is it?
GUN is an ecosystem of tools for building community-run, encrypted applications, positioned as an open source alternative to backends like Firebase. It stores data as a graph of key/value nodes that can represent documents, tables and other structures, and syncs changes in realtime between peers without a central master server.
Applications run in the browser or in Node.js, and the library works offline, merging updates when devices reconnect. Its ecosystem includes SEA for user authentication and encryption, a relay peer that can be deployed with Docker, Heroku or a Linux install script, and bindings and examples for frameworks such as React, Vue, Svelte and Electron.
The project is built around CRDT-based conflict resolution, and the README describes the core library as a lightweight embedded engine of about 9KB gzipped.
Key features
- 01Realtime peer-to-peer state synchronization between clients.
- 02Graph data model that supports key/value, tables and documents.
- 03Offline-first operation with automatic merging when reconnecting.
- 04End-to-end encryption and user auth through the SEA module.
- 05Relay peer deployment via Docker, Heroku, or a Linux install script.
Use cases
- Building collaborative or multiplayer web apps that keep working offline.
- Prototyping a serverless or decentralized backend in JavaScript.
- Creating encrypted, user-owned data stores for personal or community apps.
- Running self-hosted relay peers for a development team.
Quick start
- 1
Install the package with npm
npm install gun - 2
Run the bundled examples from the package folder
cd node_modules/gun && npm start
Things to know
- The license is listed as NOASSERTION, so check the repository's license terms before use.
- The README does not state a stable release, so expect possible changes between versions.
Topics
FAQ
- What is gun?
- A JavaScript graph-sync engine and toolkit for building decentralized, offline-first, end-to-end encrypted apps that sync peer to peer. GUN is an ecosystem of tools for building community-run, encrypted applications, positioned as an open source alternative to backends like Firebase. It stores data as a graph of key/value nodes that can represent documents, tables and other structures, and syncs changes in realtime between peers without a central master server.
- Is gun free to use? What license does it have?
- gun is open source under the Other license. Check the license terms before using it in commercial products.
- Is gun still maintained?
- Actively maintained. The last commit to gun was on Oct 15, 2026.
- What can I use gun for?
- Building collaborative or multiplayer web apps that keep working offline. Prototyping a serverless or decentralized backend in JavaScript. Creating encrypted, user-owned data stores for personal or community apps. Running self-hosted relay peers for a development team.
- How do I install gun?
- Install the package with npm: npm install gun Run the bundled examples from the package folder: cd node_modules/gun && npm start
- Where can I get gun?
- The source code and installation instructions are on GitHub: https://github.com/amark/gun
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A JavaScript library for building multiplayer web apps where browsers connect peer-to-peer over WebRTC without running your own server.
The Postgres development platform, offering a hosted Postgres database with auth, auto-generated APIs, storage and realtime features as a Firebase alternative.
A TypeScript and JavaScript ORM for Node.js and other JS platforms, supporting both Active Record and Data Mapper patterns across many SQL and NoSQL databases.
A multi-model database written in Rust that combines document, graph, relational, time-series, and key-value data with realtime queries and built-in access control.
MongoDB object modeling for Node.js, providing schemas, models, validation, and query helpers for async applications.