{"name":"OrbitDB: Peer-to-Peer Databases for the Decentralized Web","description":"OrbitDB is a serverless, distributed, peer-to-peer database designed for the decentralized web. It leverages IPFS for data storage and Libp2p Pubsub for automatic synchronization, ensuring eventual consistency through Merkle-CRDTs. This makes OrbitDB an excellent choice for p2p, decentralized, blockchain, and local-first web applications, offering various database types like event logs, documents, and key-value stores.","github":"https://github.com/orbitdb/orbitdb","url":"https://osrepos.com/repo/orbitdb-orbitdb","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/orbitdb-orbitdb","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/orbitdb-orbitdb.md","json":"https://osrepos.com/repo/orbitdb-orbitdb.json","topics":["JavaScript","Database","Decentralized","P2P","IPFS","CRDT","Distributed","Web3"],"keywords":["JavaScript","Database","Decentralized","P2P","IPFS","CRDT","Distributed","Web3"],"stars":null,"summary":"OrbitDB is a serverless, distributed, peer-to-peer database designed for the decentralized web. It leverages IPFS for data storage and Libp2p Pubsub for automatic synchronization, ensuring eventual consistency through Merkle-CRDTs. This makes OrbitDB an excellent choice for p2p, decentralized, blockchain, and local-first web applications, offering various database types like event logs, documents, and key-value stores.","content":"## Introduction\n\nOrbitDB is a serverless, distributed, peer-to-peer database that empowers developers to build applications for the decentralized web. It utilizes [IPFS](https://ipfs.tech) for robust data storage and [Libp2p Pubsub](https://docs.libp2p.io/concepts/pubsub/overview/) to facilitate automatic synchronization across peers. At its core, OrbitDB is an eventually consistent database, employing [Merkle-CRDTs](https://arxiv.org/abs/2004.00107) to manage conflict-free database writes and merges. This architecture makes it particularly well-suited for p2p and decentralized applications, blockchain solutions, and local-first web experiences.\n\nOrbitDB offers a variety of database types to cater to different data models and use cases:\n*   **Events**: An immutable, append-only log with traversable history, ideal for \"latest N\" scenarios or message queues.\n*   **Documents**: A document database for storing JSON documents, indexable by a specified key, useful for search indices or version control.\n*   **Key-Value**: A straightforward key-value database.\n*   **Key-Value Indexed**: A key-value database with data indexed in a Level key-value database.\n\nAll these databases are built upon OrbitDB's OpLog, an immutable, cryptographically verifiable, operation-based Conflict-Free Replicated Data Structure (CRDT) for distributed systems.\n\n## Installation\n\nTo get started with OrbitDB, install it and its dependencies using npm:\n\nbash\nnpm install @orbitdb/core helia\n\n\nFor browser environments, OrbitDB can also be loaded via a `<script>` tag, making `OrbitDB` available as a global namespace.\n\n## Examples\n\nHere's a quick example demonstrating how to set up an IPFS instance with Libp2p and open an OrbitDB database:\n\njavascript\nimport { createHelia } from 'helia'\nimport { createOrbitDB } from '@orbitdb/core'\nimport { gossipsub } from \"@chainsafe/libp2p-gossipsub\";\nimport { identify } from \"@libp2p/identify\";\nimport { createLibp2p } from 'libp2p'\n\nconst Libp2pOptions = {\n  services: {\n    pubsub: gossipsub({\n      // neccessary to run a single peer\n      allowPublishToZeroTopicPeers: true\n    }),\n    identify: identify()\n  }\n}\n\n;(async function () {\n  const libp2p = await createLibp2p({ ...Libp2pOptions })\n  const ipfs = await createHelia({libp2p})\n  const orbitdb = await createOrbitDB({ ipfs })\n\n  // Create / Open a database. Defaults to db type \"events\".\n  const db = await orbitdb.open(\"hello\")\n  \n  const address = db.address\n  console.log(address)\n  // \"/orbitdb/zdpuAkstgbTVGHQmMi5TC84auhJ8rL5qoaNEtXo2d5PHXs2To\"\n  // The above address can be used on another peer to open the same database\n\n  // Listen for updates from peers\n  db.events.on(\"update\", async entry => {\n    console.log(entry)\n    const all = await db.all()\n    console.log(all)\n  })\n\n  // Add an entry\n  const hash = await db.add(\"world\")\n  console.log(hash)\n\n  // Query\n  for await (const record of db.iterator()) {\n    console.log(record)\n  }\n  \n  await db.close()\n  await orbitdb.stop()\n  await ipfs.stop()\n})()\n\n\nFor more detailed examples and configurations, refer to the official [@orbitdb/quickstart](https://github.com/orbitdb/quickstart) module.\n\n## Why Use OrbitDB?\n\nOrbitDB stands out as a powerful solution for building decentralized applications due to several key features:\n\n*   **Decentralized and Serverless**: Eliminates the need for a central server, making applications more resilient and censorship-resistant.\n*   **Peer-to-Peer Synchronization**: Automatically syncs data between peers using Libp2p Pubsub, ensuring data availability and consistency across the network.\n*   **Conflict-Free Data Management**: Leverages Merkle-CRDTs to handle concurrent writes and merges without conflicts, simplifying data management in distributed environments.\n*   **Flexible Data Models**: Offers various database types, including event logs, document stores, and key-value stores, to suit diverse application requirements.\n*   **IPFS Integration**: Utilizes IPFS for content-addressed data storage, providing robust and persistent data infrastructure.\n*   **Cross-Platform Compatibility**: Works seamlessly in both browsers and Node.js environments, supporting Linux, OS X, and Windows.\n\n## Links\n\n*   **GitHub Repository**: [orbitdb/orbitdb](https://github.com/orbitdb/orbitdb){:target=\"_blank\" rel=\"noopener noreferrer\"}\n*   **API Documentation**: [api.orbitdb.org](https://api.orbitdb.org){:target=\"_blank\" rel=\"noopener noreferrer\"}\n*   **Getting Started Guide**: [GETTING_STARTED.md](https://github.com/orbitdb/orbitdb/blob/main/docs/GETTING_STARTED.md){:target=\"_blank\" rel=\"noopener noreferrer\"}\n*   **Go Implementation**: [berty/go-orbit-db](https://github.com/berty/go-orbit-db){:target=\"_blank\" rel=\"noopener noreferrer\"}\n*   **Python HTTP Client**: [orbitdb/py-orbit-db-http-client](https://github.com/orbitdb/py-orbit-db-http-client){:target=\"_blank\" rel=\"noopener noreferrer\"}","metrics":{"detailViews":0,"githubClicks":0},"dates":{"published":null,"modified":"2026-06-22T15:07:39.000Z"}}