techdiagrams.net
← All templates

Collaborative document editor

Google-Docs-style co-editing: sequence CRDTs merge concurrent keystrokes, an op-log is the source of truth, and snapshots keep join time flat.

Open in editor — free, no login Download JSON
PER-DOCUMENT AUTHORITY — OPS IN, ORDER OUTop: insert('h',pos4)route by doc idbroadcast merged ops + cursorsappendcompact periodicallyEditor Atypes 'hello' at pos 4Editor Btypes concurrently at pos 4WS Gatewayconnection registry · sticky by docDoc session (CRDT)RGA sequence CRDT · merges opsOp logappend-only · the truthSnapshot compactorops → snapshot · truncatewhy CRDT beats locks here: both editors insert atpos 4 simultaneously — the CRDT gives both a stableidentity, so A and B converge to the SAME textwithout anyone waiting or losing a keystroke.

What this design does

Two people typing in the same paragraph with no locks and no lost keystrokes — the trick is a sequence CRDT, which makes every insert commutative so replicas converge regardless of arrival order. The op-log is the durable truth; periodic snapshots keep 'open document' from meaning 'replay a year of keystrokes'. The same shape powers Notion, Linear and our own live collab.

The patterns it composes

Import it, attach your own numbers, and verify the design against failures — or read the engineering notes.