How it works
A local-first app reads and writes a database on the device, such as SQLite or IndexedDB, so every action is immediate and nothing waits on the network. A sync engine sends changes to a server or to other devices whenever a connection exists. When two people edit the same thing offline, conflict-free replicated data types (CRDTs), used by libraries such as Yjs and Automerge, or rules on the server merge the edits.
The term comes from a 2019 essay by the research lab Ink & Switch, and apps such as Linear and Obsidian are often cited as examples. Sync services such as PowerSync, ElectricSQL and Dexie Cloud do much of the hard work for web and mobile apps. It changes the role of the backend: the server becomes a place to sync and back up, not the only source of truth.
Local-first pros and cons
Pros
- Instant responses, because nothing waits for the network
- Works fully offline and on poor connections
- Users keep their data even if the service changes
- Real-time collaboration follows naturally from sync
Cons
- Sync and conflict resolution are hard to get right
- Access control and data migrations are more complex
- Large datasets may not fit on every device
When to use Local-first
Pick it when
- Notes, task and field-work apps used offline or on the move
- Collaborative editors and design tools
- Apps where the speed of every interaction matters
Skip it when
- Data that must be checked centrally first, such as payments or stock levels
- Simple content sites or forms with little data to keep
Related terms
More in Rendering and architecture
Patterns