← Questions

Design Google Docs: real-time collaborative editing

0
MetaMicrosoftGoogle+3System designLast asked Oct 2026

Design a collaborative document editor like Google Docs. Many people edit the same document at once and see each other's changes and cursors live. Edits made offline merge when the user reconnects, and the full version history is kept.

Requirements

  • Functional: create and open documents; concurrent editing with changes visible to everyone within a fraction of a second; presence (who is here) and cursors; comments; offline editing; version history and restore; sharing with permissions.
  • Non-functional: edits never lost; every client ends with the same document; low latency for typing; documents with dozens of active editors and many viewers; scales to millions of documents.

Clarifying questions

  • How many people edit one document at once, and how many view it?
  • Rich text with formatting, or plain text?
  • How long can a user stay offline and still merge?
  • How fine-grained must history be?
  • Are comments anchored to text that keeps moving?

What a strong answer covers

  • The core choice: operational transformation with a central server ordering operations, or CRDTs that merge without one; why, and how each handles offline edits.
  • A collaboration service that owns each active document (one server per document at a time), receives operations, orders and transforms them, persists them and broadcasts them.
  • Storage: an operation log plus periodic snapshots; loading a document from the latest snapshot and the operations after it; version history from snapshots.
  • WebSocket connections, reconnecting and catching up from a known version.
  • Presence and cursors as ephemeral state, separate from document content.
  • Permissions on every operation, scaling by document, and moving a hot document between servers safely.

Follow-ups

  • Two users delete overlapping text at the same moment.
  • The server that owns a document crashes during heavy editing.
  • A document is viewed by 50,000 people during a live event.
  • Comments stay attached to text as it is edited around them.
Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing