A TypeScript module for replicating SQLite databases between a mobile client (using Capacitor SQLite plugin) and a server. Version 0.0.26-b provides a master-slave replication pattern with server-side conflict resolution. It is designed for offline-first mobile apps and is framework-agnostic. Released at an early stage (pre-v1) with frequent updates. Key differentiators: works with existing SQLite queries, no query builder lock-in, supports multiple server protocols (REST, GraphQL, WebSocket), and integrates with Capacitor SQLite and Jeep-SQLite.
npm install sqlite-replicationNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up SQLite replication with Capacitor SQLite, defines collections and server sync endpoints, initializes checkpoints, and triggers a replication cycle.
Add these columns to all replicated tables: id TEXT PRIMARY KEY, updateAt INTEGER, deletedAt INTEGER, _forkParent TEXT.
Use UPDATE SET deletedAt = timestamp instead of DELETE. The client and server must keep deleted records.
Ensure your server API sorts results by updatedAt then id ascending.
Set PRAGMA foreign_keys = OFF on the client side and adjust server schema accordingly.
Use 'sqlite-replication': '0.0.26-b' (or current version) without ^ or ~ in dependencies.
Change to: import { ReplicationSQLiteStorage } from 'sqlite-replication';Ensure typescript is installed and tsconfig.json has 'moduleResolution': 'node' and 'esModuleInterop': true.
Verify the 'name' property in collections array matches the exact table name in SQLite.
ALTER TABLE mytable ADD COLUMN updateAt INTEGER NOT NULL DEFAULT 0;