CRDT Sync Overview
NodeDB bridges AP (available, partition-tolerant) on edge devices with CP (consistent, partition-tolerant) in the cloud.
How It Works
- Device writes locally — Available immediately, no network required
- CRDT delta produced — Each write generates a Loro CRDT delta
- Connectivity returns — Deltas sync to Origin via WebSocket (port 9090)
- Origin validates — SQL constraints (UNIQUE, FK, CHECK) checked at Raft commit
- Committed — Delta replicated via Raft, broadcast to connected clients
- Conflict — Failed constraints produce a typed
CompensationHintback to device
Shape Subscriptions
Devices subscribe to a subset of data — not the entire database:
SUBSCRIBE SHAPE ON users WHERE user_id = $me;
SUBSCRIBE SHAPE ON tax_rates WHERE jurisdiction IN ('US-CA', 'US-NY');
Changes within a device's shape are pushed in real time.
Multiple Devices
Multiple devices converge to the same state regardless of operation order. Loro's operation-based CRDTs guarantee eventual consistency without coordination.
Local Engine Capabilities
All seven engines work locally on NodeDB-Lite: vector search, graph traversal, document storage, columnar queries, KV lookups, FTS, and CRDT state — with sub-millisecond reads and no network dependency.