Local-first data

What are the seven ideals of local-first software?

The seven ideals of local-first software come from a 2019 essay by Ink & Switch. They are "No spinners: your work at your fingertips", "Your work is not trapped on one device", "The network is optional", "Seamless collaboration with your colleagues", "The Long Now", "Security and privacy by default" and "You retain ultimate ownership and control". Together they describe software that is fast, works offline and across devices, supports collaboration, and leaves people in control of their data.

Learning objectives

After reading this article you will be able to:

  • List the seven ideals of local-first software from the Ink & Switch essay
  • Describe what each ideal asks of an app and a first step toward it
  • Explain the costs the essay's authors found in pursuing the ideals

Where the ideals come from

In 2019, Martin Kleppmann, Adam Wiggins, Peter van Hardenberg and Mark McGranaghan of the research lab Ink & Switch published an essay proposing local-first software. Its starting point is that cloud apps give people collaboration and access from any device, while traditional apps that store files on a local disk give them ownership. The authors wanted both.

Their answer swaps the usual roles: the copy of the data on the person’s own device is primary, and servers hold secondary copies. From that shift they derive seven ideals, each named as a heading in the essay. The titles below are quoted exactly.

Working without waiting

1. No spinners: your work at your fingertips. In a cloud app, changes and many reads need a round trip to a server, which may be on another continent. Interfaces can hide the wait by showing an action as done before the server confirms it, but the request can still fail. Because a local-first app keeps the primary copy on the device, it never needs to make the person wait for a server. Sync happens quietly in the background.

2. Your work is not trapped on one device. People capture an idea on a phone, develop it on a tablet and finish it on a laptop. Local-first apps keep data in local storage on each device, so they also have to sync it across every device a person uses.

3. The network is optional. Connectivity comes and goes on trains, in lifts, in rural areas and when roaming is switched off. A local-first app can read and write its data at any time and sync later. The essay notes that sync need not go through the internet: Bluetooth or local Wi-Fi between nearby devices works too.

Working with others

4. Seamless collaboration with your colleagues. Traditional apps struggle when several people edit the same file at once, producing conflicted copies or merge conflicts that someone must resolve by hand. Cloud apps such as Google Docs set the expectation that several people can edit at once. The essay’s ideal is real-time collaboration on a par with those apps, without giving up local data. It also values other workflows, such as one person proposing changes for another to review, like suggestions in a document or a pull request on GitHub.

The essay calls this one of the biggest challenges in realising local-first software. It points to conflict-free replicated data types (CRDTs) as a promising route, because they let copies edited apart merge automatically.

Keeping the data

5. The Long Now. Work should stay accessible indefinitely, even after the company that made the software is gone. Old desktop software can keep running, if necessary in an emulator; a cloud app stops when its service does. Keeping the data and the software that reads it on the person’s own computer is what gives local-first software its longevity.

6. Security and privacy by default. Cloud apps keep everyone’s data in one central database, an attractive target for attackers and open to use by the provider. Local devices hold only their owner’s data, and local-first apps can use end-to-end encryption so that any server storing a copy holds only data it cannot read.

7. You retain ultimate ownership and control. Ownership here means agency, not copyright: people should be able to copy, modify and process their data in any way, without a provider’s API, interface or terms deciding what is allowed. The essay cites an incident in which Google Docs users were locked out of their documents after an automated system wrongly flagged them as abusive.

Scoring an app against them

The essay turns the ideals into short labels and scores existing approaches with them. A pure web app, for instance, meets only multi-device access and collaboration. A mobile app that stores data locally is fast and works offline but scores partially or poorly on the rest. None of the approaches it surveys meets all seven.

For teams building software today, it suggests a first step for each:

IdealShort labelA first step the essay suggests
1FastCache and download ahead, and trust the local cache by default
2Multi-deviceSync infrastructure, weighing its longevity and privacy costs
3OfflineTest with Wi-Fi off and with simulated poor connections
4CollaborationCRDTs, or operational transformation
5LongevityExport to flattened, standard formats such as JSON or PDF
6PrivacyMake clear when data stays on the device and when it goes to a backend
7User controlLet people back up, duplicate and delete their documents

What the ideals cost

The ideals come with responsibilities. The essay says that ownership brings the work of keeping backups, guarding against ransomware and managing archives, and argues that for important personal work this trade is worth it. It also says the ideals do not require open source.

Its own prototypes exposed technical costs. CRDTs keep their full change history, which caused performance and storage problems. Moving changes between devices remained unsolved, and NAT traversal for peer-to-peer connections was unreliable depending on the router or network a person was on. The authors concluded that servers still have a role as cloud peers for backup, discovery and forwarding changes, just not as the source of truth.

For how these ideals relate to designing an app that simply tolerates being offline, see offline-first vs local-first.

Frequently asked questions

Does an app have to meet all seven ideals to be local-first?

The essay treats them as ideals to strive for, not a pass mark. It scores existing approaches against each one and finds that none meets all seven, and it suggests teams take incremental steps.

Do the ideals require open-source software?

No. The authors say commercial and closed-source software can satisfy them, as long as it does not artificially restrict what people can do with their files.

Sources

Build it with Offline Protocol

In Offline Protocol, replicated documents live in a space, which is an existing MLS session or group, and merge when the devices in it communicate. The DataStore reference lists the document, collection and replication operations.

Read the DataStore reference