Skip to main content

Local-First

The cloud is optional. Local-first software works on your device, with or without an internet connection.

The Problem with Cloud-First

Most modern apps are thin clients to cloud services:

User ProblemsServer Risks
No internet = no appService shuts down
Latency on every actionCompany acquired
Can't work offlineTerms change
Privacy concernsData breach

Your data hostage to connectivity and corporate decisions

Local-First Principles

Local-first software:

PrincipleDescription
Works offlineFull functionality without internet
Stores data locallyYour device has the complete dataset
Syncs when possibleUpdates merge when you reconnect
You own the dataFiles you can backup, export, migrate
FastNo network latency for local operations
Long-lastingWorks decades from now
SecureData encrypted, keys under your control

The Spectrum

Cloud-FirstCloud-OptionalLocal-First
Google DocsMobile appsGit
NotionEmail clientsObsidian
FigmaNote apps with offlineCRDT apps
SlackNostr clients

Local-First in SAND

Solid Pods

While pods are typically servers, nothing prevents running a pod locally:

ApproachDescription
Local podYour laptop runs a Solid server
Sync to cloudOptionally replicate to a remote pod
Work offlineFull access to your data anytime
HybridLocal pod syncs to cloud pod

Nostr

Nostr is inherently local-first:

  • Identity is your key (no server needed)
  • Events cached locally
  • Multiple relays = no single point of failure

DIDs

Decentralized identifiers are local by nature:

DID MethodLocal-First Aspect
did:keyIdentity IS the key pair, stored locally
did:nostrSame—your npub is your identity
did:webRequires resolution, but key stays local

Sync and Conflict Resolution

The challenge with local-first: what happens when two devices edit the same data offline, then reconnect?

Solutions

ApproachHow It WorksTrade-offs
CRDTsData structures that automatically mergeComplex to implement
Operational TransformMerge edits like Google DocsRequires server
Last-write-winsMost recent edit winsMay lose data
Manual resolutionUser decides (like Git)Requires user attention

CRDTs (Conflict-free Replicated Data Types)

CRDTs are the gold standard for local-first sync:

CRDT Properties:

  • Commutative: A + B = B + A
  • Associative: (A + B) + C = A + (B + C)
  • Idempotent: A + A = A

No conflicts by design

CRDT LibraryLanguageFeatures
AutomergeRust/JS/SwiftJSON-like documents
YjsJavaScriptRich text, fast
Diamond TypesRustText-focused
cr-sqliteSQLiteCRDT database

Benefits

Cloud-FirstLocal-First
Requires internetWorks offline
Server latencyInstant response
Data on their serversData on your device
Service can shut downYour data persists
Privacy concernsData stays local
Subscription requiredOwn it forever
Updates may break thingsYou control updates

Trade-offs

Local-first isn't free:

ChallengeConsideration
StorageYour device needs space for all your data
Sync complexityMerging distributed data is hard
Initial setupMay need to sync a large dataset first
Multi-deviceNeed good sync infrastructure
BackupsYou're responsible for your data
SearchFull-text search harder without server

Local-First Architecture

Sync layer is optional — app works fully offline

Real-World Examples

AppHow It's Local-First
GitFull repo history locally, syncs via push/pull
ObsidianMarkdown files on disk, optional sync
VS CodeLocal files, optional remote
Bitcoin walletsKeys local, sync via blockchain
Nostr clientsEvents cached, keys local

Getting Started

  1. Choose local-first tools — Obsidian for notes, Git for code
  2. Run a local podSandymount can run locally
  3. Store keys locally — Use Noskey or Amber for Nostr keys
  4. Backup — You're responsible for your data now
  5. Learn CRDTs — Understand how sync works

The Seven Ideals

From the foundational Ink & Switch paper:

IdealDescription
FastNo network round-trips
Multi-deviceWorks on all your devices
OfflineFull functionality without internet
CollaborationReal-time with others
LongevityWorks in 50 years
PrivacyYou control access
User controlYour data, your rules

Learn More