On Local-First Software

The cloud ate everything. Your notes, your files, your conversations — all living on someone else’s computer, behind someone else’s API, subject to someone else’s pricing changes.

Local-first software is a reaction to this. The idea is simple: your data lives on your device first, and syncs to others when needed. The network is a convenience, not a requirement.

What local-first actually means

The term comes from a 2019 Ink & Switch paper that laid out seven ideals:

  1. No spinners — your work is on-device, reads are instant
  2. Your work is not trapped behind an API
  3. The network is optional
  4. Seamless collaboration when online
  5. The Long Now — your data outlives the service
  6. Security and privacy by default
  7. You retain ownership and control

Most apps satisfy zero of these. A few satisfy one or two. Almost none satisfy all seven.

The hard part

Conflict resolution. Two devices edit the same document offline. When they reconnect, what happens?

CRDTs (Conflict-free Replicated Data Types) are the most promising answer. They’re data structures designed so that concurrent edits always converge to the same state, without coordination.

// A simple last-writer-wins register
interface LWWRegister<T> {
  value: T;
  timestamp: number;
  nodeId: string;
}

function merge<T>(a: LWWRegister<T>, b: LWWRegister<T>): LWWRegister<T> {
  if (a.timestamp > b.timestamp) return a;
  if (b.timestamp > a.timestamp) return b;
  return a.nodeId > b.nodeId ? a : b;
}

This is the simplest CRDT. Real applications need richer structures — sequences for text, sets for collections, maps for key-value stores. Libraries like Automerge and Yjs handle this complexity.

Why now

The tools are finally catching up to the ideas. SQLite runs in the browser via WASM. CRDTs are mature enough for production. Edge computing puts servers close to users. And people are increasingly uncomfortable with how much of their digital life they don’t actually own.

The signal is clear: build software that respects the person using it.