ShareDB is a realtime database backend based on Operational Transformation (OT) for JSON documents. Version 0.13.3 is current, with active development and releases on npm. It features synchronous editing API with asynchronous eventual consistency, realtime query subscriptions, and horizontal scalability via pub/sub. Differentiators include OT-based conflict resolution, middleware for access control, and built-in reconnection and offline sync. It integrates with MongoDB and Redis for persistence and pub/sub.
npm install k-syncNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup with Mongo, query subscription, document create/op, and subscribe.
Use `const connection = backend.connect()` (returns a Connection instance).
Attach event listeners directly on the query object.
doc.submitOp(op, (err) => { if(err) handleError(err); });Check `doc.type === null` before calling create.
Ensure your MongoDB server version is compatible.
npm install sharedb-mongo
Use new ShareDB(options) then call connect() on the instance.
Check doc.type === null before calling create.
Always subscribe to the document before submitting ops, or use a retry mechanism.