Registry / database / livedb

livedb

JSON →
library0.5.13jsnpmunverified

Database wrapper for realtime applications, providing the backend for ShareJS, Racer, and Derby. This package (v0.5.13 at current release) exposes an API for submitting operations (via OT), subscribing to document changes, and making live queries. It requires a separate database backend (e.g., livedb-mongo for MongoDB) and an optional driver for multi-server setups. Key differentiators: built for Operational Transformation, stores all operations forever, and supports live query result feeds. Note: the v5 releases listed are for the related share/sharedb package, not livedb itself; livedb appears to be in maintenance mode with no recent updates.

npm install livedb
INSTALL
IMPORT
SIG · LIVEDB
L
livedb
databasejavascriptv0.5.13
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import livedb from 'livedb'
const livedb = require('livedb')
Package uses CommonJS default export; ESM import requires default import syntax.
client
import { client } from 'livedb'
const client = require('livedb').client
Named export 'client' available; common mistake is to destructure incorrectly.
MemoryDb
import { MemoryDb } from 'livedb/client'
import { MemoryDb } from 'livedb'
MemoryDb is exported from 'livedb/client', not the main entry point.

Shows how to connect to MongoDB via livedb-mongo, subscribe to a document, and submit create and edit operations using OT.

const livedb = require('livedb'); const db = require('livedb-mongo')('localhost:27017/test?auto_reconnect', { safe: true }); const backend = livedb.client(db); backend.fetchAndSubscribe('users', 'fred', function(err, data, stream) { if (err) return console.error(err); console.log('Initial version:', data.v); stream.on('data', function(op) { console.log('Operation received:', op); }); }); backend.submit('users', 'fred', { v: 0, create: { type: 'json0', data: { name: 'Fred' } } }, function(err) { if (err) return console.error(err); console.log('Document created'); backend.submit('users', 'fred', { v: 1, op: [{ p: ['name', 4], si: ' Flintstone' }] }, function(err) { if (err) return console.error(err); console.log('Edit applied'); }); });
Debug
Known issues
breakingThe v5.x releases (such as v5.2.2) refer to the share/sharedb package, not livedb itself. livedb v0.5.13 is the last known version and may not receive updates.
fix
Consider migrating to sharedb (npm: sharedb) which is the successor.
affects: >=0.5.13
deprecatedThe inprocess driver is default but deprecated for multi-server setups; it does not support cross-process operation publishing.
fix
Use a Redis-based driver for multi-server scenarios.
affects: >=0.4.0
gotchaMemoryDb stores all operations in memory until server restart; data is lost on shutdown.
fix
Use a persistent backend like livedb-mongo for production.
affects: >=0.1.0
gotchaOperations from different servers will not be visible unless a driver (e.g., Redis) is used; otherwise each server only sees its own operations.
fix
Initialize livedb with a driver: livedb.client(db, { driver: redisDriver }).
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'livedb-mongo'
Missing livedb-mongo package when trying to use MongoDB backend.
fix
npm install livedb-mongo
TypeError: backend.submit is not a function
Did not call livedb.client(db) properly; likely imported wrong symbol.
fix
Use const backend = livedb.client(db); then call backend.submit(...).
Error: Unsupported OT type 'json0'
OT type json0 not registered or available.
fix
Install the ot-json0 package and register it: const json0 = require('ot-json0'); livedb.types.register(json0.type);
Upgrade
Version history
0.5.13latest on npm
Audit
Dependencies
livedb-mongooptionalMongoDB backend for persisting documents and ops
ottypesoptionalOT types (e.g., json0, text) used for document operations
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
livedb — npm install livedb · libregistry