Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Atomic Sync overview

Sync exists so that your data lives on your devices, and you stay in control of it. Most apps keep your data on one company’s server, and the app on your phone is just a window onto it. That makes it hard to leave, and it gives the company a reason to keep it that way: a business model built on holding your data hostage, or on selling your attention. We argue in the motivation that this is what vendor lock-in does, and local-first is how we get out of it.

With Atomic Sync, every device that uses a Drive keeps a full local copy and reads and writes it directly. You’re not tied to one vendor’s cloud, because a server is just one more device that holds a copy. Sync runs in the background and passes changes between those copies, so they stay in agreement.

The idea in five points

  1. Every device has a full local copy. The app reads and writes the local store, so it keeps working offline. See local-first.
  2. Edits are signed commits. A change becomes a Commit: a Loro CRDT update plus an Ed25519 signature from the Agent that made it. Anyone can check who changed what.
  3. Copies merge automatically. Each Resource is a Loro document, so edits made at the same time on different devices merge without a coordinator. Merging does not check your business rules, though. Your application decides when a merged result needs review.
  4. Every receiving node checks permissions. A node verifies the signature and the signer’s write right before it applies a change, and it only sends a peer what that peer’s Agent may read. See permissions and identity.
  5. A server is just another peer. An AtomicServer runs the same sync engine as a phone or a browser tab. It’s usually the one that stays online, but it doesn’t own anything. See remote peers.

What happens to an edit

You change a Resource on your device, and the change lands in the local store at once. It is signed, and put in an outbox. When a peer is reachable, the device first compares what each side has, using version vectors, and then exchanges only what differs. While the link stays open, later edits are pushed as they happen. If you’re offline, the outbox keeps your edits, even across a restart, and sends them when a peer comes back.

An edit's journey On a phone, the edit "Rename task" is written to the local store, signed as a commit and queued in the outbox. The outbox sends it to a desktop app and to an always-on node, which each verify and merge it. Phone: edit "Rename task" 1 Local storesaved at once 2 Signed commitEd25519 + Loro 3 Outboxkept if offline Desktop appverified, merged Always-on nodeverified, merged

Atomic Sync walks through this in more detail.

Over any transport

Every app that runs the engine is a node, in the browser or native. Nodes reach each other over WebSocket, HTTP, Iroh or WebRTC, whichever fits where they are. The transport only decides how two devices find each other: the commits and the checks are the same on every link.

One protocol, four transports Every app is a node running the same sync engine. An AtomicServer is reached by a web app over WebSocket and by a script over HTTP. A desktop app reaches it over Iroh and a phone app reaches the desktop app over Iroh. Two web apps connect over WebRTC. AtomicServeralways on Web appWeb app Desktop appPhone app Script HTTP WebSocket Iroh WebRTC Iroh same engine, same commits, on every link

Transports explains each one and when to use it.

If you want toRead
Choose how devices connectTransports
Understand what two devices exchangeDrive reconciliation
Know who may read and write during syncPermissions and identity
Keep a Drive available while your devices are offRemote peers
Build an app on the engineBuilding on the sync engine
Implement a client or peerWire protocol
Compare with a hosted backendAtomic vs Supabase and Firebase

The product-level pitch, and what you do not have to build yourself, is on Local-first Sync Engine.