# Local-first software

> Software that treats the copy of your data on your own device as the primary one, so it works offline and syncs with other devices and people when it can.

Source: https://plexiidesk.com/glossary/local-first-software

Local-first software keeps your work on your own computer or phone first, and uses servers to sync and share it rather than to hold the only real copy. You can open, edit and save without waiting for a network, and your changes reach other devices and collaborators when a connection is there.

## Where the term comes from

The term was proposed in the essay [Local-first software: you own your data, in spite of the cloud](https://www.inkandswitch.com/essay/local-first/) by Martin Kleppmann, Adam Wiggins, Peter van Hardenberg and Mark McGranaghan of Ink & Switch, published at the Onward! symposium in 2019.

The essay contrasts it with cloud apps. In a cloud app, "the data on the server is treated as the primary, authoritative copy of the data", and a copy on your device "is merely a cache". Local-first apps "swap these roles". The authors chose the name because such software "prioritizes the use of local storage (the disk built into your computer) and local networks (such as your home WiFi) over servers in remote datacenters."

## The seven ideals

The essay lists seven ideals that local-first software should strive for:

1. "No spinners: your work at your fingertips"
2. "Your work is not trapped on one device"
3. "The network is optional"
4. "Seamless collaboration with your colleagues"
5. "The Long Now"
6. "Security and privacy by default"
7. "You retain ultimate ownership and control"

These are ideals, not a certification: the authors call them ideals "we would like to strive for".

## Offline-first and local-first

The two are related but not the same. **Offline-first** is about an app continuing to work without a connection; the essay credits the "Offline First movement" with encouraging better offline support, and notes it "has been difficult to retrofit offline support to cloud apps". **Local-first** goes further: it is about where the authoritative copy lives and who controls it. An offline-first app can still treat the server's copy as the real one; a local-first app does not.

## CRDTs in one paragraph

The hard part is collaboration: if two people edit the same thing on different devices while offline, how do the changes combine? The essay highlights **Conflict-free Replicated Data Types (CRDTs)**, which "emerged from academic computer science research in 2011". They are data structures, like lists and maps, that are "multi-user from the ground up", and they can sync "via any communication channel", from a server to a USB stick. The authors describe them as having "the potential to be a foundational technology for realizing local-first software", while saying more work is still required.

### An example

You edit a document on a flight with no connection. Because the document and the editor are on your laptop, nothing is blocked. When you land, your changes sync, and a colleague's edits made in the meantime are combined with yours.

## How PlexiiDesk relates

How PlexiiDesk approaches this is explained in [Local-first, explained: where your work lives in Plexii](https://plexiidesk.com/blog/local-first-explained). This page describes the general concept only.

## Sources

- [Kleppmann, Wiggins, van Hardenberg and McGranaghan: Local-first software: you own your data, in spite of the cloud (Ink & Switch, Onward! 2019)](https://www.inkandswitch.com/essay/local-first/)
