explaingit

vlcn-io/cr-sqlite

Analysis updated 2026-07-03

3,703RustAudience · developerComplexity · 3/5Setup · moderate

TLDR

A SQLite extension that lets multiple copies of a database accept independent changes and then merge them without conflicts, enabling offline-first apps and real-time collaboration.

Mindmap

mindmap
  root((cr-sqlite))
    What it does
      Merge database copies
      No conflict errors
      Like Git for data
    Use cases
      Offline first apps
      Multi-device sync
      Collaborative editing
      Local first writes
    How it works
      Load extension
      Upgrade tables
      crsql_changes table
      Insert to sync
    Performance
      Reads unchanged
      Writes 2.5x slower
      SQLite and libSQL
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build an offline-first app that writes data locally and syncs with a server when reconnected, with no manual conflict resolution.

USE CASE 2

Enable real-time collaborative editing where multiple users modify the same data concurrently and changes merge automatically.

USE CASE 3

Sync a user's SQLite database across multiple devices without writing custom merge or conflict logic.

USE CASE 4

Add local-first instant writes to any SQLite-backed app while syncing changes in the background.

What is it built with?

RustSQLitelibSQLC

How does it compare?

vlcn-io/cr-sqlitecurlpipe/oxkube-rs/kube
Stars3,7033,7023,704
LanguageRustRustRust
Setup difficultymoderateeasyhard
Complexity3/52/54/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires loading a native SQLite extension, writes to synced tables are about 2.5x slower than standard SQLite writes.

In plain English

CR-SQLite is an extension for SQLite, a popular embedded database, that lets two or more separate copies of the same database accept independent changes and then merge those changes together without data conflicts. The project's own description calls it "like Git, for your data" because it handles the same kind of diverge-then-reconcile problem that version control handles for code files. This is useful in several specific situations: syncing a database across a user's devices, building collaborative editing features where multiple people change data at the same time, letting an app keep working while offline and then sync when reconnected, and making an app feel instant by writing locally first and syncing in the background. Without something like CR-SQLite, an application developer has to write custom logic for each of these scenarios. The way it works is that you load the extension into your existing SQLite database and then call a function to upgrade any table you want to keep in sync. After that, a special virtual table called crsql_changes records what has changed. To sync two databases, you query that table on one side and insert the results into the other side. SQLite then figures out which changes win using rules built into the extension. On the performance side, the README notes that writes to synced tables are currently about 2.5 times slower than writes to regular SQLite tables, while reads are unchanged. The extension is available for SQLite and also for libSQL, a fork of SQLite. The repository includes example applications, tutorials, and links to live demos so you can see the sync behavior in action before integrating it into your own project.

Copy-paste prompts

Prompt 1
Using cr-sqlite, show me how to load the extension, upgrade a table for sync, and merge changes from a second database by reading and inserting from crsql_changes.
Prompt 2
How do I set up cr-sqlite with libSQL in a JavaScript app to sync a todos table between two users in real time?
Prompt 3
Walk me through building an offline-first note-taking app with cr-sqlite that queues writes locally and syncs them when the device comes back online.
Prompt 4
How do I inspect what changes are pending sync in cr-sqlite's crsql_changes virtual table, and how do I apply them on the receiving side?
Prompt 5
What is the performance cost of using cr-sqlite on synced tables versus regular SQLite tables, and what can I do to minimize it?

Frequently asked questions

What is cr-sqlite?

A SQLite extension that lets multiple copies of a database accept independent changes and then merge them without conflicts, enabling offline-first apps and real-time collaboration.

What language is cr-sqlite written in?

Mainly Rust. The stack also includes Rust, SQLite, libSQL.

How hard is cr-sqlite to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is cr-sqlite for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub vlcn-io on gitmyhub

Verify against the repo before relying on details.