CRDT-based replication
Causal-Length Set, Delete-Wins, Add-Wins, and Grow-Only Set algorithms keep replicas convergent.
Offline-first data
Turn any local SQLite database into an offline-first replica that syncs with SQLite Cloud, PostgreSQL, or Supabase when the network is available.
SQLite Sync
SQLite and PostgreSQL native extension
Best for
Offline sync and Markdown memory
Repository
GitHubProject
SQLite Sync is a multi-platform extension that adds CRDT-based replication to ordinary SQLite tables. Applications write locally first, keep working offline, and converge automatically when they reconnect.
It is built for local-first apps, mobile and desktop software, IoT fleets, edge systems, and AI agents that need shared state without building a custom synchronization backend.
Why it matters
Capabilities
Causal-Length Set, Delete-Wins, Add-Wins, and Grow-Only Set algorithms keep replicas convergent.
Line-level merge for text and markdown columns preserves independent edits to different blocks.
Use the embedded network layer to send and receive sync packages with one SQL call.
Sync local SQLite replicas with SQLite Cloud nodes, PostgreSQL servers, or Supabase instances.
SQLite Cloud policies enforce which rows each client can sync in multi-tenant deployments.
Runs on Linux, macOS, Windows, iOS, Android, and WASM, with platform packages available.
Sample code
Load the extension, initialize the table, write locally, then sync when connectivity is available.
-- Load SQLite Sync
.load ./cloudsync
CREATE TABLE tasks (
id TEXT PRIMARY KEY,
title TEXT NOT NULL DEFAULT '',
done INTEGER NOT NULL DEFAULT 0
);
-- Enable CRDT sync on the table
SELECT cloudsync_init('tasks');
-- Use SQLite normally, even offline
INSERT INTO tasks (id, title)
VALUES (cloudsync_uuid(), 'Ship offline-first app');
-- Connect and synchronize when ready
SELECT cloudsync_network_init('your-managed-database-id');
SELECT cloudsync_network_set_apikey('your-api-key');
SELECT cloudsync_network_sync();