System Design Collaborative Editor: Interview Talk Track
"Design a collaborative document editor" is a popular system design prompt because it mixes real-time networking, conflict resolution, storage, and scaling in one problem. You don't need to have built one. You need a clear structure, sensible trade-offs, and the ability to say what you'd choose and why.
This system design collaborative editor interview talk track walks through a 45-minute answer you can adapt.
1. Clarify requirements (about 5 minutes)
Start by agreeing on scope. Good questions:
- Text only, or rich text with images and tables?
- How many people edit one document at once? Ten, or thousands?
- Do we need offline editing?
- Do we need version history and comments?
- What latency feels acceptable for seeing someone else's typing?
A reasonable scope to propose: rich text, up to around 50 concurrent editors per document, edits appear for others within a few hundred milliseconds, version history, and basic offline support as a stretch goal.
Non-functional goals: low latency, no lost edits, all users converge to the same document, and high availability.
2. Rough estimates (about 3 minutes)
Keep it simple and say your assumptions out loud. If there are many millions of documents but only a small fraction are open at any time, the hard part isn't storage volume; it's keeping many small real-time sessions fast and consistent. Each keystroke is a tiny operation, so bandwidth per session is small, but the number of messages is high.
3. High-level design (about 10 minutes)
Sketch these components:
- Clients with a local copy of the document, applying edits immediately so typing feels instant.
- Real-time gateway holding WebSocket connections.
- Collaboration service that owns active document sessions: it orders operations, resolves conflicts, and broadcasts updates.
- Operation log storing every accepted operation in order.
- Snapshot store with periodic full copies of each document, so loading doesn't replay the entire history.
- Metadata service for document ownership, permissions, and sharing.
- Presence service for cursors and who's online.
Flow: a user types, the client applies the edit locally and sends the operation to the collaboration service, which transforms or merges it, appends it to the log, and broadcasts it to the other clients.
4. Deep dive: conflict resolution (about 12 minutes)
This is the heart of the interview. Two people edit the same spot at the same time; everyone must end up with the same document.
Operational transformation (OT). A central server orders operations. When an operation arrives based on an older version, the server transforms it against operations that happened since. For example, if one user inserts at position 5 and another already inserted three characters at position 2, the first insert shifts to position 8. OT works well with a central authority and is a well-established approach for server-mediated editors.
CRDTs (conflict-free replicated data types). Each character or element gets a unique, ordered ID, and merges are mathematically guaranteed to converge regardless of order. CRDTs shine for peer-to-peer and offline editing, but they can carry more metadata and memory overhead.
A good talk track: "With a central server and mostly online users, I'd pick OT for its simpler data model. If offline editing is a core requirement, I'd lean toward a CRDT. Either way, the client applies edits optimistically, then reconciles with the server."
5. Storage and versioning
- Append every operation to the log with document ID and version number.
- Every N operations or every few minutes, write a snapshot.
- To load a document: read the latest snapshot, then replay operations after it.
- Version history comes almost free from the log and snapshots.
Mention compaction: old operations can be folded into snapshots to save space while keeping named versions.
6. Scaling
- Route by document. All editors of one document should land on the same collaboration server, using consistent hashing on document ID. This keeps ordering simple.
- Failover. If that server dies, another takes over by loading the snapshot and log. Clients reconnect and resend unacknowledged operations, with IDs to avoid duplicates.
- Hot documents. A document with thousands of viewers can separate editors from read-only viewers and fan out updates through a pub/sub layer.
- Presence can be lossy and ephemeral. Cursor positions don't need durable storage.
7. Other topics if time allows
- Permissions: check access on connect and on each operation.
- Offline: queue operations locally and sync on reconnect, which is where CRDTs help.
- Comments and suggestions: anchor them to element IDs rather than raw positions so they move with text.
- Monitoring: track operation latency, reconnect rates, and divergence checks via document checksums.
8. Wrap up with trade-offs
Close by summarizing: central ordering with OT for simplicity, operation log plus snapshots for durability and history, document-affinity routing for consistency, and lossy presence for speed. Name the main risk, such as a hot document overloading one server, and how you'd handle it.
Practice the talk track out loud
System design rounds reward structure and calm narration. Rehearse this answer with a timer until you can hit requirements, design, deep dive, and trade-offs without rushing.
Luna Interview is a practice and calm-under-pressure companion for that kind of rehearsal, with timed sessions and structured prompts in your browser. Try Luna Interview at https://lunainterview.xyz/.
Rehearse with an AI interview copilot, then browse commonly reported interview questions.