← All posts
Concepts

What is a CRDT, and why it matters for collaborative apps

TL;DR

A CRDT (Conflict-free Replicated Data Type) is a data structure designed so that several people can edit the same thing at the same time, even offline, and when the edits meet, they merge automatically into the same result for everyone: no conflicts, no "which copy wins?", no referee. It's the math that makes Google-Docs-style multiplayer possible, and it's why modern collaborative apps don't ask you to take turns.

Two people edit the same page at once and a CRDT merges both changes automatically, so every copy converges to the same result.
Both edits happen. Both survive. Everyone converges.

The problem it solves

Two people open the same page. One changes the headline; the other, at the same moment, recolors the button. Each is editing their own local copy (that's physics: networks have delay), so for a moment the copies disagree. Now what?

The old answers were all bad in a familiar way: lock the file so only one person can edit (the "checked out by Dave" era), last-write-wins so somebody's work silently vanishes, or surface a conflict dialog and make a human sort it out (the <<<<<<< experience, for the git-scarred). Every one of them turns simultaneity, the normal condition of teamwork, into an error.

What a CRDT does differently

A CRDT restructures the data itself so that concurrent changes can always be combined. Instead of storing "the document is this string of text," it stores the document as many small pieces with identities and relationships: this character sits after that one, inserted by editor A at logical time 5. Edits become facts about pieces ("A inserted X here," "B deleted Y"), and the structure guarantees that any two sets of facts can merge, in any order, and produce the identical result on every copy.

That last property is the whole trick: merge is built into the type, not bolted on by a server. Which yields, in practice:

  • No locks, no turns. Everyone edits at once; simultaneity is normal, not an error.
  • The same result everywhere. Apply the edits in any order, on any machine: every copy converges. Nobody's change silently loses.
  • Offline just works. Edits made on a plane are facts like any others; they merge on reconnect.
  • No referee required. A server can help relay updates, but correctness doesn't depend on it: the merging logic travels with the data.

Why this matters for AI-built apps

Documents got their multiplayer machinery years ago. AI-built apps raise the bar in two ways. First, the thing being co-edited is structured markup, a live page (HTML), not a string of prose: the CRDT has to model elements, attributes, and styles so that "Ana edits the headline" and "Sam restyles the button" merge as sensibly as two text edits. Second, the editors aren't all human: an agent may push a revision while two people edit by hand, three concurrent editors with very different rhythms. Without CRDTs underneath, the collaboration layer those apps need would be back to locks and lost updates, which is to say, back to attachments.

The best-known open-source implementation is Yjs, which powers multiplayer in a long list of collaborative tools; CRDT research and practice are collected at crdt.tech.

How Coedit fits

Coedit's shared documents are CRDTs (built on Yjs): the page your team edits is stored as structured, mergeable state, mapped losslessly to and from HTML (9/9 round-trip test suites). That's what lets a teammate edit copy while an agent pushes a revision without anyone's work vanishing; the merge behavior is held to a 47/47 concurrent-editing test suite. You never see any of this, which is the point: the math's job is to make simultaneity boring.

FAQ

Q: What does CRDT stand for? A: Conflict-free Replicated Data Type: a data structure that can be replicated across many machines, edited concurrently on each, and merged automatically with every copy converging to the same result.

Q: How is a CRDT different from how Google Docs works? A: Google Docs historically used operational transformation (OT), which achieves similar multiplayer editing but leans on a central server to order operations. CRDTs build mergeability into the data itself, so they tolerate offline edits and don't require a server referee. Newer collaborative tools mostly reach for CRDTs.

Q: Do CRDTs mean no conflicts ever? A: They mean no technical conflicts: every merge succeeds and converges. Two humans can still disagree about what the headline should say; version history and comments handle the human layer.

Q: Why should a non-developer care? A: Because it's the difference between "the file is locked by someone else" and just working together. If your team edits a shared AI-built app without taking turns or losing changes, a CRDT is probably why.

Your AI work shouldn't stop at a file.

Turn the page your AI made into a link anyone can open, comment on, and edit. No code, no account to view.

Get your live link →