System Design

Collaborative Editor

Design a real-time collaborative document editor like Google Docs.

Functional requirements

  • Multiple users can concurrently edit the same rich-text document and see each other's changes in near real time.
  • Users see live presence indicators: who is in the document and where their cursors/selections are.
  • Documents auto-save continuously; users can view version history and restore prior versions.
  • Users can share documents with view/comment/edit permission levels.
  • Editors continue working through brief disconnects (e.g., flaky wifi) and their changes sync when reconnected.

Non-functional requirements

  • Edits from one collaborator must appear on other collaborators' screens within ~200ms end-to-end under normal conditions.
  • All replicas of a document must converge to the identical final state regardless of edit ordering (strong eventual consistency for document content); permission checks are strongly consistent.
  • No acknowledged edit may ever be lost; durability of committed operations is non-negotiable.
  • The system prioritizes availability of the editing surface: local typing must never block on the network (optimistic local application).
  • Authorization checks must be applied to document reads and writes.

Scaling & constraints

  • 50M DAU; a typical active user has 2-3 documents open per session.
  • Peak concurrency per hot document: up to 100 simultaneous editors; typical is 2-5.
  • An active editor generates 1-5 operations/second while typing; each operation is ~100-500 bytes.
  • Average document size 50KB; 99th percentile 2MB; 5B total documents stored.
  • Full version history retained for 1 year; op-level granularity required for the most recent 30 days.
  • Read:write ratio on documents is roughly 10:1 (many viewers per editor).

Out of scope

  • Rich media handling (embedded images/video storage pipelines): treat as opaque blob references.
  • Offline-first mobile apps with multi-day offline editing sessions.
  • Search across documents and the Drive-like file/folder organization layer.
  • Real-time voice/video or chat features attached to documents.

Sign in to save your progress

AI design evaluation

Get a grounded score, what your design does well, its gaps, and what to study next.

Sign in to evaluate

Sign in to get AI feedback on your design.