CRDT (Conflict-free Replicated Data Types) — a class of data structures that can be updated independently on multiple replicas and merged deterministically without conflict resolution. Foundation of collaborative editors (Notion, Figma, Linear). Types: G-Counter (grow-only), LWW-Set (last-write-wins), RGA (replicated growable array for text). Libraries: Yjs, Automerge.
Below: details, example, related terms, FAQ.
// Yjs collaborative text
const ydoc = new Y.Doc();
const ytext = ydoc.getText('content');
ytext.insert(0, 'Hello');
// Syncs over WebSocket — other users see updateOT (Google Docs) — server-authoritative, transforms operations. CRDT — peer-to-peer compatible, merges without a server. CRDT wins offline-first.
Yjs handles thousands of edits/sec. Automerge is slower but more featureful. Both in production (Linear, Figma).
No — overhead. CRDTs make sense for collaborative editing or true offline-first UX.