Sync Protocol
WebSocket-based sync on port 9090 for NodeDB-Lite clients. CRDT deltas flow between edge devices and Origin for all eight storage engines and their overlays.
Supported Collections
All collection engines participate in sync:
- Document (schemaless + strict)
- Key-Value
- Columnar, Timeseries, Spatial
- Vector and Array
- Graph and Full-Text Search overlays on synced collections
Schema changes (new columns, new collections) are discovered automatically by connected Lite clients after the Origin catalog commit.
How It Works
- Lite client connects via WebSocket to Origin
- Client sends its current LSN watermark
- Origin sends any missed deltas since that watermark
- Client sends locally accumulated CRDT deltas
- Origin validates constraints (UNIQUE, FK, CHECK) via Raft
- Committed deltas are broadcast to all connected clients with matching shape subscriptions
Shape Subscriptions
Devices subscribe to a subset of data via shape subscriptions (wire-level sync feature, not SQL):
Shape subscription: users WHERE user_id = $me
The client only receives data matching this filter. Changes within a device's shape are pushed in real time. Changes outside the shape are not sent.
Compensation Hints
If a local write violates a constraint on Origin, a typed CompensationHint is sent back:
UniqueViolation— duplicate key detectedForeignKeyMissing— FK target doesn't existSchemaViolation— CHECK constraint or type rule failedIntegrityViolation— other integrity-rule violationPermissionDenied— insufficient privilegeRateLimited— quota or rate limit exceededCustom— application-specific handling
The application handles the conflict — no silent data loss.