Building applications where multiple users simultaneously edit the same text document, whiteboard canvas, or design board (like Google Docs, Figma, Notion, or Linear) is one of the most intellectually challenging problems in systems design.

When two users concurrently insert or delete characters at the same position in a document without locking, naive character indexing causes divergence, scrambled text, and lost edits.

This module deconstructs the two foundational paradigms for concurrent collaboration:

  • Operational Transformation (OT): Centralized coordination, transformation matrices, and server-side operation reordering (the Google Docs and Apache Wave architecture).
  • Conflict-Free Replicated Data Types (CRDTs): Decentralized mathematical convergence, semilattices, causal trees, fractional indexing, and peer-to-peer offline sync (the Yjs, Automerge, and Figma architecture).
  • Ephemera & Presence: Real-time cursor positions, user selection highlights, and WebSocket synchronization.

What you will learn

  • Compare Operational Transformation (OT) and Conflict-Free Replicated Data Types (CRDTs) regarding algorithmic complexity, centralization, and offline editing support
  • Trace transformation functions: Inclusion Transformation T(op1, op2) in centralized OT servers (Google Docs model)
  • Formulate mathematical semilattices for State-based (CvRDT) and Operation-based (CmRDT) convergence: commutativity, associativity, and idempotency
  • Implement an RGA (Replicated Growable Array) or Yjs/Automerge tree structure for deterministic concurrent text editing
STAGE TOPICS

Topics in this chapter