Design Collaborative Document Editing System

Collaborative document editor inspired by Google Docs and Figma's multiplayer service: real-time multi-cursor editing with operational transformation, an operation log as the source of truth, presence, permissions and version history. A teaching design, not Google's or Figma's internal architecture.

Functional requirements

  • Real‑time multi‑cursor editing with low latency.
  • Conflict resolution via OT or CRDT; per‑character granularity.
  • Presence: online users, cursors, selections.
  • Granular permissions: owner/editor/commenter/viewer; sharing links.
  • Version history with diff/restore; operation log retention.
  • Offline editing with background sync and conflict repair.
  • Rich content: images, tables, embeds, comments, suggestions.
  • Search across documents with relevance and filters.

Non-functional requirements

  • Latency: realtime ops < 100 ms p95 E2E; steady state < 50 ms.
  • Availability: 99.95%+; partial AZ failure must not drop editing.
  • Consistency: strong for permissions; convergent for document state; read‑your‑writes for a user session.
  • Durability: version history and audit logs retained with backups.
  • Security: TLS 1.2+; signed share links; at‑rest encryption; scoped tokens.
  • Resilience: timeouts, circuit breakers, retries/backoff, DLQs.
  • Observability: traces/logs/metrics for op latency, room fanout, queue depth, and convergence errors.

How the design evolves

Stage 1: Single Server, Save the Whole Document

See why saving whole documents breaks as soon as two people edit at once.

What was missing: Nothing yet: one server and one database hold every document.

Why that's risky: Two people typing at once overwrite each other (last write wins), nobody sees others' changes without reloading, and 100K saves per second swamp one server.

What gets added: An app server that saves the whole document on each change, and a database holding one copy per document.

Trade-offs: Simplest possible design, but it has no notion of concurrent edits at all.

Stage 2: Edits as Operations: OT and an Operation Log

Send small operations instead of documents, order them in one place, and never lose a concurrent edit.

What was missing: Edits were whole-document overwrites, so concurrent changes were lost and there was no history.

Why that's risky: Collaborators still don't see each other's changes until they reload: nothing broadcasts the ordered operations yet.

What gets added: A WebSocket path for small operations, a collaboration server that owns each active document and orders its edits with operational transformation (OT), and an append-only operation log as the source of truth. A separate Docs API handles opening and listing files.

Trade-offs: One owner per document gives a simple total order but makes that server a hot spot for very busy documents. CRDTs avoid the central owner at the cost of heavier data structures.

Stage 3: Broadcast and Presence

Show every editor's changes and cursors to everyone else in the file within a fraction of a second.

What was missing: Ordered operations reached the log but never reached the other editors; cursors were invisible.

Why that's risky: Snapshots, search and notifications would otherwise run on the typing path and slow every keystroke.

What gets added: A per-file broadcast channel and the gateways' push side, so each transformed operation reaches every other client of the file, plus an in-memory presence service for cursors and selections.

Trade-offs: Presence is deliberately not durable: losing cursor positions on a restart is acceptable, saving them would double database writes.

Stage 4: Snapshots, Search and Notifications off the Hot Path

Move everything that isn't needed to acknowledge an edit into background jobs.

What was missing: Snapshot building, indexing and notifications had nowhere to run except on the typing path.

Why that's risky: Opening files and listing them still hit the primary documents database, and embedded images have no home.

What gets added: A change queue fed by committed operations; a snapshot compactor that folds operations into periodic snapshots; a search indexer and search index; and a notification service for @mentions, comments and shares.

Trade-offs: Search lags edits by a few seconds and notifications are eventually sent, in exchange for typing never waiting on them.

Stage 5: Read Replicas, Media and CDN

Serve opening, listing and embedded images without loading the primary database.

What was missing: All reads went to the primary database and there was no storage or delivery for images.

Why that's risky: Anyone with a link could still reach any file: there is no permission check on API calls or WebSocket joins, and no record of who accessed what.

What gets added: A read replica for opening and listing files, a media service and object storage for embedded images, and a CDN for the editor's static files and images.

Trade-offs: Replica reads can be a moment behind, which is fine for file lists; the operation log itself is never read from a replica.

Stage 6: Permissions, Audit and Observability

Enforce sharing rules on every request and connection, record access, and watch the system's health.

What was missing: No access control on requests or connections, no audit trail, and no visibility into the system's health.

Why that's risky: Remaining risk is operational: hot documents, region failures and convergence bugs must be caught by monitoring and drills.

What gets added: A permissions service (owner, editor, commenter, viewer, link sharing) with a cache invalidated on every sharing change, checks on every API call and WebSocket join, an append-only audit store, and monitoring.

Trade-offs: Permissions are strongly consistent (revoking access applies immediately), unlike search and notifications.

Frequently asked questions

OT vs CRDT — which should I choose?

CRDTs guarantee convergence without a central server but are heavier; OT with a central transformer is simpler and efficient for text. Choose based on offline needs and operation semantics.

How do you support offline editing safely?

Buffer ops locally with session IDs and lamport/hybrid clocks; on reconnect, submit to a sync/repair pipeline that deduplicates, orders, and merges changes; surface conflicts in UI when needed.

What should you audit in a collaborative editor?

All access decisions and mutations: who viewed/edited, share link grants, permission changes, doc ownership transfers, and administrative overrides; retain immutable logs with secure retention.

How do you test convergence and performance?

Create deterministic simulations of concurrent edits, fuzz op sequences, and validate snapshot equality across replicas; run load tests for fan‑in/out and operation latency distributions.

How do you secure sharing and access?

Use time‑bounded, scope‑limited tokens for share links; enforce authZ centrally via a permissions service; log all grants and revocations to an audit store.

PRISM
System Design Interview
Round 1 of 4 · Architecture Design · 60:00 remaining
PRISM logo PRISM logo
Problems
AI Interview
Interview Challenges
Build & Stress Test NEW
System Architectures
Design & Fix NEW
Interactive Roadmap
System Design Guides Interview Prep Guide
Problems
Today's mission
Notifications
    Theme
    Pricing Community NEW Send feedback Report a problem NEW
    Sign in
    Theme
    Community NEW Send feedback Report a problem NEW
    All problems
    Phase
    Build & Stress Test
    Phase 01: Thinking in Systems
    Upcoming

    Components

    User
    CDN
    Load Balancer
    Server
    Cache
    Database
    Blob Storage
    Search Index
    Queue
    Worker
    Rate Limiter
    Service
    API Gateway
    Reverse Proxy
    WebSocket Server
    Third-party API

    Inspector

    Notes
    Use clear names so your design intent is easy to understand.
    Good
    Name by business meaning
    "Order API", "Restaurant Service"
    Avoid
    Generic names = zero signal
    "Server 1", "API", "Queue"
    A short description for each component makes feedback much better.
    100%
    Start by identifying:
    • Users & entry points
    • APIs & services
    • Databases & storage
    • Traffic flow & scale

    Round 1 of 4 Architecture Design

    Run a simulation to see results.

    Time Remaining
    60:00
    System Design Interview

    What are the core functional requirements?
    What are the key non-functional constraints?

    Questions

    Start Evaluation to unlock questions.

    EVALUATE MODE

    Test yourself like it's the real thing.

    A structured 4-module evaluation that mirrors how top companies assess system design candidates.

    Architecture Design
    Draw your system on the canvas. Define components, connections, and data flow.
    FR & NFR Requirements
    Answer functional and non-functional requirement questions about your design.
    MCQ Round
    Multiple choice questions testing your depth on the chosen system.
    Tradeoff Analysis
    Justify your design decisions and defend your architectural tradeoffs.
    AI Report Generated
    Choose a Problem
    No problem selected
    • 30 min
    • 45 min
    • 60 min
    Round 2 of 4
    MCQ Round
    Answer multiple-choice questions based on your design.

    Exit Interview?

    You're in the middle of an interview session. Leaving now will end your current attempt.

    Your progress will be saved.

    Open a saved design

    Select a design to load into the canvas.

    My Evaluations

    Your past evaluation sessions

    Here’s a simple request flow that follows the expected layer order.

    External User
    →
    Edge CDN → API Gateway → Load Balancer
    →
    Compute App Servers / Services
    →
    DataAccess Cache
    →
    Storage Database / Search Index
    →
    Async Queue → Worker

    Tip: keep arrows moving forward through layers (Edge → Compute → Storage). Avoid sending storage back to compute.

    Evaluation Instructions

    Read the rules carefully before starting. The test auto-submits on refresh.

    Before you start

    • Build your architecture on the canvas. The timer starts when you click Start Evaluation.
    • Don't forget to answer Functional Requirement and Non Functional Requirements.
    • When satisfied with your design, click Next to lock it and view the questions.
    • Please answer final step questions to complete the evaluation.

    Dos

    • Do read each question carefully before answering.
    • Do include required components to maximize component coverage.
    • Do save a copy of your design if you want to keep it before submission.

    Don'ts

    • Don't refresh or close the tab during an active evaluation — this will auto-submit your answers.
    • Don't switch app modes or open another tab while the evaluation is running.
    • Don't attempt to edit the design after clicking Next; the workspace will be locked.

    All the best!!

    Confirm

    Input

    Notice

    Evaluation Report
    Report a problem

    Evaluation Complete

    Generating Your Report

    Hang tight — our AI is evaluating your design…

    Did you know?

    Loading…

    Share feedback

    Tell us what worked well and what we can improve.

    Let's personalize this

    Answer a couple of quick questions so we can tailor your journey and missions.

    Your welcome gift: of Full PRISM Access

    Your Pro access starts as soon as you press Start my journey.

    SYSTEM BRIEF

    System Constraints

    What the system must do — every item is a user-facing behaviour your architecture must support.

      ↑ Engineering Constraints

      These are the failure modes you must design against — latency SLAs, durability targets, traffic ceilings.

        ⇆ Architecture Constraints

        Core Concepts to Master

        Your Journey
        PHASE – –
        0 / 0 0%
        0
        Mock Interview Checklist

        Pick a topic to start

        Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.

        Phase Mastered

        You've conquered this phase. These are the skills you now own:

          +500 XP

          Company Interview Paths

          Progress Summary