Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 6 min read Deep dive easyNovice

Comparing local-first frameworks and approaches

Local-first software keeps data on the user's device and syncs opportunistically, and three representative approaches take different routes to it. Automerge uses CRDTs to merge concurrent edits without a coordinating server. PouchDB is a browser-side document database that syncs with CouchDB and resolves conflicts by deterministically picking a winning revision while keeping the losers for manual resolution. ElectricSQL is a server-side sync engine that reads Postgres logical replication and streams subsets of data ("shapes") to clients. Short code samples show each API, framed by the seven ideals of the Ink & Switch local-first manifesto.

Related posts

  • Building Local-First Apps: The Complete Guide to Offline-First Database Sync

    Turso mediumAdept

    Turso Sync brings local-first behaviour to SQLite-based apps. Local changes are captured via change data capture and pushed as logical row-level mutations, while remote changes are pulled as physical pages so replicas converge byte-for-byte. Turso's benchmarks report up to 312x faster syncs and roughly 18x less traffic than the older Embedded Replicas approach. The guide covers TypeScript setup with background push/pull loops, Last-Push-Wins conflict resolution and a transform hook for custom merges such as turning sets into increments, scoped auth tokens and JWKS, sync-aware WAL checkpointing, and experimental partial sync. It also notes that there is no CRDT or peer-to-peer support, which makes the approach a poor fit for real-time collaborative document editing.

  • Turso Sync: Local-First SQLite with Push and Pull

    Turso mediumAdept

    Turso Sync replaces libSQL's page-based Embedded Replicas with logical row-level changes captured via CDC in Turso Database, a Rust rewrite of SQLite, so reads and writes stay local and apps call push() and pull() explicitly. Shipping logical statements instead of WAL pages lets unrelated writes merge on the server. Experimental partial sync fetches 128 KiB segments on demand, with optional prefetch. Benchmarks show roughly 7–10x speedups and about 15x less data for small-write workloads, but only 1.2x when writes are already batched. Conflicts resolve by last-push-wins, which suits single-writer data but loses updates on shared counters unless data is modeled append-only.

  • pg_crdt - an experimental CRDT extension for Postgres

    Supabase easyNovice

    pg_crdt is an experimental, open-source Postgres extension that adds CRDT column types (wrapping the Yjs and Automerge Rust libraries via pgx), so a column like a post's content can be a Yjs Doc whose updates are commutative and idempotent. Supabase argues for storing CRDTs in the database rather than making Realtime the authoritative server, to avoid coupling and enable tools like Debezium, while allowing per-column choice between last-write-wins and CRDT merging. Known limitations block production use: WAL-based broadcast sends the whole document on small edits, frequent updates generate heavy WAL and dead tuples, and large documents incur serialization overhead.

  • One Postgres, a database per user, or both?

    Turso easyNovice

    Choosing between one Postgres database, a Turso database per user, or both comes down to where data must live, who owns it, and how many features need to read across users. Early-stage web apps default to a single Supabase Postgres with row-level security and a self-hosting exit. Local-first apps like Sample Vault give each user a Turso database synced to their machine, which provides isolation by construction and data ownership if the product disappears. Hybrid apps use Supabase to govern accounts, auth and storage while per-user Turso databases hold user data. Because database-per-user is "a bet against cross-user features", teams should list every cross-user read before adopting it; the agent delegation case shows the cost, since delegated tasks must be copied into a central database.

  • Introducing Offline Writes for Turso

    Turso easyNovice

    Turso is opening a private beta for Offline Writes, letting applications write to local embedded SQLite replicas while online or offline and sync those changes to the cloud later. Local writes land in the SQLite write-ahead log, and sync pushes or pulls WAL frames to and from the remote database. Conflict handling stays simple and assumes mostly serialized writers: the first push wins, and the others pick a strategy such as fail-on-conflict, discard-local, rebase-local or a custom resolver. The pitch is that pairing this with a database-per-user design makes local-first apps simpler, because the whole database syncs rather than a selected subset.

The quest for software engineering knowledge.

Look:
Layout: