
Electric SQL Has Free Local-First Sync — Here's How to Build Offline-Ready Apps
What if your app worked offline and synced when connected? Electric SQL makes local-first development practical. What is Electric SQL? Electric SQL syncs data between PostgreSQL in the cloud and SQLite on the client. Your app reads and writes locally (instant), and Electric handles the sync. Why Local-First? Instant responses — reads and writes hit local SQLite, not a network round-trip Works offline — app functions without internet Multi-device sync — changes propagate to all devices Conflict resolution — automatic, based on CRDTs Quick Start bun add @electric-sql/client Syncing Data import { ShapeStream , Shape } from ' @electric-sql/client ' ; // Define a shape (what data to sync) const stream = new ShapeStream ({ url : ' http://localhost:3000/v1/shape ' , params : { table : ' tasks ' , where : ' user_id = 123 ' , }, }); const shape = new Shape ( stream ); // Subscribe to changes shape . subscribe (( data ) => { console . log ( ' Tasks updated: ' , data ); // data is always the late
Continue reading on Dev.to Webdev
Opens in a new tab



