Skip to content
System Design Explorer
concepts

Collaborative Editing (OT & CRDTs)

By Ankur NayakReviewed

Collaborative editing lets several people change the same document at once and still end up with identical copies. The main approaches are operational transformation (OT), conflict-free replicated data types (CRDTs), and simpler server-ordered schemes like Figma's, where a central server orders changes and each property is last-writer-wins.

Collaborative Editing (OT & CRDTs) diagramComponents: Alice's Editor, Document Server, Bob's Editor. Connections: Alice's Editor to Document Server (colour = red); Bob's Editor to Document Server (colour = blue).Alice's EditorClientDocument ServerRealtime gatewayBob's EditorClient
Server-ordered last-writer-wins

How it works

The problem: each client applies its own edits immediately so the app feels instant, but edits from others arrive later and in different orders. Without care, two clients that apply the same edits in different orders end up with different documents.

Operational transformation rewrites each incoming operation against the operations it was concurrent with, so 'insert at position 5' becomes 'insert at position 6' if someone inserted a character earlier. It suits text, but Figma's 2017 post notes that with OT, adding more operation types increases implementation complexity quadratically.

CRDTs design the data itself so that concurrent updates merge the same way regardless of order: for example, a last-writer-wins register keeps the value with the latest timestamp. They can work without a central server, at the cost of extra metadata.

Figma takes a middle path. Each document is a tree of objects with properties, and one server process per document is the authority. Each property behaves like a last-writer-wins register, in the order the server receives changes. Clients apply edits locally, and ignore incoming server values that conflict with their own unacknowledged changes so the screen doesn't flicker. Child order uses fractional indexing: each child's position is a fraction between 0 and 1, so inserting between two siblings only picks a value between theirs.

Key points

  • Apply local edits immediately; reconcile later
  • OT transforms operations; CRDTs make merges order-independent
  • A central server can simply define the order
  • Last-writer-wins per property avoids most conflicts
  • Fractional indexes order siblings without renumbering

When to use it, and pitfalls

Use it for

  • Real-time multiplayer editors (design tools, docs, whiteboards)
  • Offline-first apps that sync later
  • Shared state such as presence and cursors

Watch out for

  • Last-writer-wins silently drops one of two concurrent edits to the same field
  • Tree structures need cycle checks when two people move nodes
  • Undo must stay sensible while others edit
  • CRDT metadata and tombstones can grow large

Trade-offs

Central authority vs decentralised merging

Use a server to order changes when clients are always online-ish; use CRDTs when peers must merge without a server.

Pros: Central: simple rules, small messages; CRDTs: work peer-to-peer and offline

Cons: Central: needs a live server per document; CRDTs: more metadata and complexity

Used in

Frequently asked questions

What is the difference between OT and CRDTs?

Operational transformation adjusts each operation against concurrent ones so they can be applied in any order, typically with a server coordinating. CRDTs build the merge rules into the data structure so replicas converge whatever order updates arrive in, even without a server.

Why doesn't Figma use true CRDTs?

Because Figma has a central server that is the authority for each document, it can define the order of changes itself. Each property then behaves like a last-writer-wins register, without the extra metadata true CRDTs need to merge without a coordinator.

Sources