132Design Google Docs: collaborative editing with CRDT or OT, cursors, and conflict resolution
hardAbout 60 minutesSystem designcollaborationcrdtoperational-transformationreal-timesystem-design
Problem
Design the frontend of a collaborative document editor like Google Docs:
- several people edit the same rich-text document at the same time and see each other's changes within a fraction of a second;
- everyone ends up with the same document, whatever order edits arrive in;
- remote cursors and selections are shown with names and colours;
- editing keeps working offline and merges when the connection returns;
- version history and undo that only undoes your changes.
Explain the editor model, the choice between Operational Transformation (OT) and CRDTs, the sync protocol, presence, and performance for long documents.
Video walkthroughs
Stuck? Watch someone solve it, then try again on your own.
Step-by-step
The editor (turning keystrokes into a document model and rendering it), convergence (merging concurrent edits so every replica ends identical), and presence (ephemeral cursors). They have different consistency and persistence needs.
Unlock the full solution
What's inside
- Step-by-step
- Requirements
- Architecture
- Data model and state
- Key flows and trade-offs
- Performance and reliability
- Follow-up questions
Includes 1 code listing, 5 follow-up questions.
One-time payment by UPI, card or net banking. Launch price.