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.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Module is ESM-only; no CommonJS export.
import { ReplicSQLite } from 'replic-sqlite'
Server factory is exported from a subpath; not at package root.
import { createServer } from 'replic-sqlite/server'
Default export provides a pre-configured instance; named export ReplicSQLite is the class.
import Replic from 'replic-sqlite'
Shows how to set up a replic-sqlite server and client with WebSocket transport for multi-writer replication.
import { ReplicSQLite } from 'replic-sqlite';
import { createServer } from 'replic-sqlite/server';
import Database from 'better-sqlite3';
const db = new Database(':memory:');
db.exec(`CREATE TABLE IF NOT EXISTS todos (id TEXT PRIMARY KEY, task TEXT, done INTEGER)`);
db.exec(`CREATE TABLE IF NOT EXISTS todos_patches (id TEXT PRIMARY KEY, patch BLOB)`);
const replic = new ReplicSQLite({ db, secret: process.env.SECRET ?? 'changeme' });
// Create a WebSocket server that handles sync
const server = createServer({ replic, port: 8080 });
server.start();
console.log('Replic server running on ws://localhost:8080');
// In another process, connect a client
import WebSocket from 'ws';
const ws = new WebSocket('ws://localhost:8080');
const replicClient = new ReplicSQLite({ db: new Database(':memory:'), secret: 'changeme' });
replicClient.connect(ws);
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.