sydepsystem design atlas

Collaborative Document Editor (Google Docs-style)

Multiple users edit the same document in real time via operational transforms.

AdvancedMediaPlatform
Editor AClientEditor BClientCollaboration ServiceComputeDocument StoreStorageOperation LogMessaging

Each edit is sent as an operation over a real-time connection; a collaboration service applies operational transformation (or CRDT merge) to reconcile concurrent edits and broadcasts the resolved state to every connected client.

When to use it

  • Multiple users must see each other's edits live, in the same document, without overwriting one another
  • Occasional offline edits need to merge back in without manual conflict resolution

Trade-offs

  • Operational transform / CRDT logic is intricate and easy to get subtly wrong
  • Full document history and undo need careful design on top of the merge algorithm

Components used

Single-Page AppManaged App ServiceDocument DatabaseEvent Stream

How it works

  • Each keystroke becomes an operation sent over a persistent connection rather than a document save.
  • Operational transformation (or a CRDT) adjusts concurrent operations against each other so every client converges on the same document regardless of arrival order.
  • The server sequences operations and periodically snapshots the document so new joiners do not replay from the beginning.

Used in the wild

  • Real-time document, spreadsheet and whiteboard editing.
  • Collaborative code editors and design tools.
  • Shared notes with live presence indicators.

Good to know

  • Operational transformation is notoriously difficult to implement correctly. Google Wave's engineers reported it took far longer than expected, and several published OT algorithms were later shown to be subtly wrong.
  • CRDTs are the modern alternative — correct by construction and offline-friendly — but they accumulate metadata, and a heavily edited document can carry more tombstones than text.