Replic-sqlite adds multi-writer, conflict-free replication to SQLite via CRDT patches, using only ~800 lines of code. Version 0.4.0 is actively developed and already used in production. Key differentiators: extremely lightweight, no leader bottleneck, protocol-agnostic transport, selective per-table replication, crash-safe, and supports rolling schema upgrades. Compared to libSQL, Turso, cr-sqlite, or dqlite, it is purely embedded (no separate process) and relies on CRDT for eventual consistency without strong ordering.
npm install replic-sqliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up a replic-sqlite server and client with WebSocket transport for multi-writer replication.
Add a `_patches` table (id TEXT PRIMARY KEY, patch BLOB) for each table you want to sync.
Use `import { createServer } from 'replic-sqlite/server'` instead of `import { createServer } from 'replic-sqlite'`.Rename 'syncInterval' to 'syncIntervalMs' in the config object.
Always construct your own `ReplicSQLite` instance with explicit `db` parameter for predictable database location.
Ensure 'secret' is the same string on every node. Use environment variables to distribute it.
Run `npm install replic-sqlite@latest`. Use correct import: `import { createServer } from 'replic-sqlite/server'`. Note that the 'server' subpath was added in v0.4.0.If using ESM, use `import { ReplicSQLite } from 'replic-sqlite'`. If using CommonJS, replic-sqlite does not support it; wrap with dynamic import or switch to ESM.Create a `_patches` table for each table you intend to replicate: `CREATE TABLE todos_patches (id TEXT PRIMARY KEY, patch BLOB)`.