Interview Questions/System Design/Design Collaborative Document Editing
AdvancedSystem-Design
45 min

Design Collaborative Document Editing

RealtimeCRDT/OTStorageNetworking
Advertisement
Interview Question

Design a Google Docs–style collaborative editor with real-time edits, offline support, and conflict resolution.

Key Points to Cover
  • Data model with OT or CRDTs; op logs and compaction
  • Real-time transport (WebSockets) and presence cursors
  • Offline edits, merges, and conflict resolution
  • Access control, snapshots, and version history
  • Scalability: sharding docs, fanout to collaborators
Evaluation Rubric
Sound OT/CRDT conflict strategy30% weight
Efficient real-time sync & presence25% weight
Offline merge & recovery approach25% weight
Sharding and fanout under load20% weight
Hints
  • 💡CRDTs avoid centralized transformation servers.
Common Pitfalls to Avoid
  • ⚠️Choosing an unsuitable data model (e.g., a naive array with simple merges leading to race conditions).
  • ⚠️Underestimating the complexity of OT transformation functions and their edge cases.
  • ⚠️Inefficient network usage leading to lag and a poor real-time experience.
  • ⚠️Poorly designed offline storage and synchronization logic, leading to data loss or desynchronization.
  • ⚠️Lack of robust conflict resolution mechanisms that lead to confusing or incorrect document states for users.
Potential Follow-up Questions
  • How to compact op logs?
  • How to prevent edit storms?
Advertisement