What is GUN?
GUN is a graph synchronization protocol with a lightweight embedded engine, capable of doing 20M+ API ops/sec in just ~9KB gzipped size. The Internet Archive and hundreds of other apps run GUN in production, processing terabytes of daily P2P traffic.GUN was created by Mark Nadal in 2014 after spending 4 years trying to get collaborative web apps to scale with traditional databases. The goal was to build a P2P database that could survive inside any browser and correctly sync data between any device after any offline-first activity.
Key features
GUN provides several powerful capabilities that make it unique:Realtime synchronization
Multiplayer by default with realtime peer-to-peer state synchronization across all connected devices
Graph data structure
Use key/value pairs, tables, documents, videos, and more - all in a flexible graph structure
Offline-first
Local-first architecture with offline support and automatic synchronization when reconnected
Decentralized
No master servers, no single source of truth - data syncs peer-to-peer with end-to-end encryption
How GUN works
Unlike traditional master-slave database architectures that create bottlenecks, GUN operates as a distributed graph database:- No master - No servers, no “single source of truth”
- All data types - Not just SQL or NoSQL, but graphs, documents, tables, and key/value
- Offline-first - Works in any browser and syncs correctly after offline activity
- Conflict resolution - Uses CRDT algorithms to handle concurrent updates
- Modular stack - Includes cryptographic security, storage serialization, mesh networking, and more
Use cases
GUN powers decentralized alternatives to many popular services:Chat applications
Real-time messaging with offline support
Collaborative tools
Shared documents and workspaces
Social networks
Decentralized social platforms like Iris
Video conferencing
P2P video calls like Meething
IoT devices
Distributed sensor networks
Gaming
Multiplayer games with P2P sync
Example: Basic data operations
Here’s a quick example showing GUN’s simplicity:Example: Graph relationships
GUN handles circular references and graph traversal naturally:The NoDB philosophy
GUN challenges traditional database conventions:- No master-slave architecture - Eliminates single points of failure
- No DevOps required - Runs anywhere JavaScript runs
- No locking - CRDT-based conflict resolution
- No language barriers - Built for the web, works everywhere
Community and ecosystem
GUN is built by a friendly community of developers creating a free, fun future. The ecosystem includes:- SEA (Security, Encryption, Authorization) - Cryptographic security and user authentication
- AXE - Mesh networking and routing algorithms
- RAD - Radix storage serialization
- Modules - GraphQL, Vue, React, Svelte, Angular integrations and more
Join the chat
Get help from the friendly GUN community
View examples
Explore real-world GUN applications
Next steps
Ready to start building with GUN?Quickstart
Get up and running in 5 minutes
Installation
Install GUN for your platform