-1
日增长
8,826
stars
595
forks
150
watchers
620
prs
579
issues
0
releases
README
OrbitDB
OrbitDB is a serverless, distributed, peer-to-peer database. OrbitDB uses IPFS as its data storage and Libp2p Pubsub to automatically sync databases with peers. It's an eventually consistent database that uses Merkle-CRDTs for conflict-free database writes and merges making OrbitDB an excellent choice for p2p and decentralized apps, blockchain applications and local-first web applications.
OrbitDB provides various types of databases for different data models and use cases:
- events: an immutable (append-only) log with traversable history. Useful for "latest N" use cases or as a message queue.
- documents: a document database to which JSON documents can be stored and indexed by a specified key. Useful for building search indices or version controlling documents and data.
- keyvalue: a key-value database just like your favourite key-value database.
- keyvalue-indexed: key-value data indexed in a Level key-value database.
All databases are implemented on top of OrbitDB's OpLog, an immutable, cryptographically verifiable, operation-based conflict-free replicated data structure (CRDT) for distributed systems. OpLog is formalized in the paper Merkle-CRDTs. You can also easily extend OrbitDB by implementing and using a custom data model benefitting from the same properties as the default data models provided by the underlying Merkle-CRDTs.
This is the Javascript implementation and it works both in Browsers and Node.js with support for Linux, OS X, and Windows.
A Go implementation is developed and maintained by the Berty project at berty/go-orbit-db.
Installation
Install OrbitDB and its dependencies:
npm install @orbitdb/core helia
Browser tag
OrbitDB can be loaded in the browser using the distributed js file with the tag. OrbitDB is the global namespace and all external functions are available via this namespace:
/path/to/orbitdb.min.js
Quick Start
If you want to get up and running with OrbitDB quickly, install and follow the instructions in the @orbitdb/quickstart module.
Usage
If you're using @orbitdb/core to develop browser or Node.js applications, use it as a module with the javascript instance of IPFS.
javascript
import { createHelia } from 'helia'
import { createOrbitDB } from '@orbitdb/core'
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
import { identify } from "@libp2p/identify";
import { createLibp2p } from 'libp2p'
const Libp2pOptions = {
services: {
pubsub: gossipsub({
// neccessary to run a single peer
allowPublishToZeroTopicPeers: true
}),
identify: identify()
}
}
;(async function () {
const libp2p = await createLibp2p({ ...Libp2pOptions })
const ipfs = await createHelia({libp2p})
const orbitdb = await createOrbitDB({ ipfs })
// Create / Open a database. Defaults to db type "events".
const db = await orbitdb.open("hello")
const address = db.address
console.log(address)
// "/orbitdb/zdpuAkstgbTVGHQmMi5TC84auhJ8rL5qoaNEtXo2d5PHXs2To"
// ThTop issues
#1228Typescript implementation19 comments · 2025-05-18#931Database Encryption & Read Protection 15 comments · 2021-10-16#243WebUI to manage OrbitDB and databases13 comments · 2017-11-05#577OrbitDB Stickers10 comments · 2019-03-05#1164database record limits for acceptable lookup performance7 comments · 2024-02-23#512Lamport clock can be set far into future making db progress halt7 comments · 2018-11-29#1255Sync never delivers the first entry to a reader connected only through a relay5 comments · 2026-07-22#1244OrbitDB incompatible with streaming blockstores (js-stores PR #358)3 comments · 2025-11-13
Discussions
#1237OrbitDB Identity vs libp2p PeerId0 comments · 2025-08-24#1235How much does this cost to use since its based on IPFS?2 comments · 2025-08-01#1236Secure update propagation: Homomorphic hashing1 comments · 2025-07-15#1220Help me understand Access Controllers in OrbitDB to implement a Superadmin/Admin structure.2 comments · 2025-02-11#1218How to wait for replication to complete when opening a database?1 comments · 2025-02-04#1210Is it possible to add signature verification to the replication process?0 comments · 2024-12-13#1209Performance of OrbitDB0 comments · 2024-12-12#1208Hi can you explain orbitDB storage model1 comments · 2024-12-01