Most databases assume your data lives in one place. A server in the cloud, a managed instance, a single source of truth somewhere on the network.
That assumption breaks as soon as you're building for the edge.
If you're running AI models on devices, building offline-capable applications, or syncing data across a fleet of hardware with intermittent connectivity, the traditional cloud-first data layer doesn't hold up. Round-trips are too slow. Disconnections are expected, not exceptional. And forcing everything through a central server creates a single point of failure in environments that are supposed to be autonomous.
DefraDB is a peer-to-peer document database designed for these environments. It just reached v1.0 RC1, its first stable release candidate, after 25 pre-production releases and more than 1,750 commits.
What it is
DefraDB is a NoSQL document store. You define schemas, store JSON-like documents, and query them with DQL, a query language compatible with GraphQL. If you've used MongoDB or Firestore, the interaction model will feel familiar.
The difference is how it handles sync, conflict resolution, and data integrity across distributed nodes.
Merkle CRDTs. Every document update is stored as a node in a Merkle DAG using Conflict-Free Replicated Data Types. Two devices can independently modify the same document while offline. When they reconnect, changes merge deterministically. The result is identical regardless of the order updates arrive. No conflict resolution logic in your application code. No last-write-wins.
Content-addressable data. Every piece of data is identified by its content, not its location. Any node can serve a request and the recipient can cryptographically verify the response.
P2P networking. Nodes communicate directly with each other. No central coordination server. You can configure passive sync via pubsub, active replication to specific peers, or both.
Automatic schema transformation. In edge environments, not every device runs the same software version. DefraDB includes a transformation engine (LensVM) that converts data between schema versions using bi-directional lenses. Devices on v3 of your app can sync with devices still running v2, without a coordinated rollout or a centralized schema registry.
Access control at the data layer. Relationship-based access control at the document level, using cryptographic identity (DIDs), with field-level control coming soon. Policies travel with the data.
Quick start
git clone https://github.com/sourcenetwork/defradb.git
cd defradb
make install
defradb start
Add a schema:
defradb client collection add '
type User {
name: String
age: Int
verified: Boolean
points: Float
}
'
Create a document:
defradb client document add --collection User '{
"name": "Alice",
"age": 32,
"verified": true,
"points": 85
}'
Query it:
defradb client query '
query {
User {
_docID
name
points
}
}
'
That's a single node. The real value shows up when you start a second node and sync between them. The documentation walks through P2P setup with pubsub and replicator peering.
What shipped in v1.0 RC1
The main push in this release was API stabilization. The Go SDK, CLI, HTTP/OpenAPI endpoints, GraphQL schema, C bindings, and JavaScript bindings all went through a systematic naming audit. Verb-first conventions, consistent terminology, typed option builders. When v1.0 final ships, these interfaces won't break under you.
New capabilities include branchable collection sync, searchable encryption, LevelDB as a storage backend for WASM deployments, secp256k1 public key support, a setup wizard for first-run configuration, collection truncation, and recursive explain for nested query joins. Node Access Control now gates every operation in the system.
DefraDB compiles to a single binary. The C bindings and JS bindings mean you can embed it into mobile apps, browser-based applications, IoT firmware, or virtually any runtime supporting WASM or C-interoperability.
Who this is for
Edge AI is the most immediate use case. Models running on devices need fast local access to structured data for inference, context, and personalization. That data needs to sync across devices without cloud round-trips and stay consistent when connectivity drops. DefraDB gives on-device AI a local, queryable, self-syncing data layer that works whether the device is online or not.
Beyond AI, it fits anywhere data needs to work at the edge: robotics, autonomous systems, field operations, collaborative tools.
Links
This is a release candidate. If something breaks or an API feels wrong, now is the time to tell us. v1.0 final is next.
Top comments (0)