# Local-First Software
Local-first software is a design philosophy where applications store data primarily on the user's device rather than in the cloud, while still supporting collaboration and sync. The term was formalized in a 2019 paper by Martin Kleppmann and collaborators at Ink & Switch, titled "Local-First Software: You Own Your Data, in spite of the Cloud." Local-first apps work offline by default, sync when connectivity is available, and give users full ownership of their data. This contrasts with cloud-first apps (Google Docs, Notion) where data lives on company servers and requires internet access.
The approach addresses growing concerns about data ownership, privacy, vendor lock-in, and longevity. When cloud services shut down, users lose their data; with local-first, data persists on user devices. Key technical challenges include conflict resolution when multiple devices edit simultaneously—addressed by technologies like CRDTs (Conflict-free Replicated Data Types). Local-first principles align with the [[File over app principle]] and support [[Personal Knowledge Management (PKM)]] tools that prioritize user data sovereignty. Examples include [[Obsidian]] (local Markdown files), [[Logseq]] (local-first with optional sync), and Linear (collaborative but local-capable).
## Local-First Principles
```
┌─────────────────────────────────────────────────────────────┐
│ LOCAL-FIRST SOFTWARE PRINCIPLES │
│ (Ink & Switch, 2019) │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. NO SPINNERS: FAST │
│ • Data is local → instant response │
│ • No round-trip to server │
│ │
│ 2. YOUR WORK IS NOT TRAPPED IN ONE DEVICE │
│ • Sync across devices │
│ • Multi-device access │
│ │
│ 3. THE NETWORK IS OPTIONAL │
│ • Works offline │
│ • Syncs when connected │
│ │
│ 4. SEAMLESS COLLABORATION │
│ • Real-time or async collaboration │
│ • Conflict resolution │
│ │
│ 5. THE LONG NOW │
│ • Data outlives the app │
│ • Open formats, user ownership │
│ │
│ 6. SECURITY AND PRIVACY BY DEFAULT │
│ • End-to-end encryption │
│ • Data stays on device unless shared │
│ │
│ 7. YOU RETAIN OWNERSHIP AND CONTROL │
│ • No vendor lock-in │
│ • Export your data anytime │
│ │
└─────────────────────────────────────────────────────────────┘
```
## Local-First vs Cloud-First
| Aspect | Local-First | Cloud-First |
|--------|-------------|-------------|
| **Data location** | User's device | Company servers |
| **Offline access** | Full functionality | Limited or none |
| **Speed** | Instant (local) | Network latency |
| **Ownership** | User owns data | Company controls |
| **Longevity** | Data persists | Service may shut down |
| **Privacy** | Data stays local | Company can access |
| **Collaboration** | Via sync (CRDTs) | Native |
| **Complexity** | Higher (sync) | Lower (centralized) |
## Key Technologies
| Technology | Purpose |
|------------|---------|
| **CRDTs** | Conflict-free Replicated Data Types |
| **Automerge** | CRDT library for local-first apps |
| **Yjs** | CRDT framework for collaboration |
| **SQLite** | Local database |
| **IndexedDB** | Browser-based storage |
| **libp2p** | Peer-to-peer networking |
## CRDTs Explained
```
Device A: "Hello" → "Hello World"
↘
Merge → "Hello World!"
↗
Device B: "Hello" → "Hello!"
CRDTs enable automatic, conflict-free merging
without a central server to coordinate.
```
## Benefits
| Benefit | Description |
|---------|-------------|
| **Speed** | No network latency for operations |
| **Reliability** | Works without internet |
| **Privacy** | Data doesn't leave device |
| **Ownership** | User controls their data |
| **Longevity** | Data survives app/company death |
| **Portability** | Move data between apps |
## Challenges
| Challenge | Solution Approach |
|-----------|-------------------|
| **Sync conflicts** | CRDTs, operational transforms |
| **Storage limits** | Selective sync, compression |
| **Multi-device** | Sync protocols, P2P |
| **Collaboration** | Real-time CRDT sync |
| **Backup** | User responsibility or optional cloud |
| **Development complexity** | Libraries like Automerge |
## References
- Kleppmann, M. et al. (2019). "Local-First Software: You Own Your Data, in spite of the Cloud"
- https://www.inkandswitch.com/local-first/
- https://crdt.tech/
## Related
- [[File over app principle]]
- [[Personal Knowledge Management (PKM)]]
- [[Obsidian]]
- [[Logseq]]
- [[Data Ownership]]
- [[CRDTs]]
- [[Offline-First]]