System design interview question
Design a Real-Time Collaborative Document Editor with Conflict Resolution
Build a low-level design for a Google Docs-like collaborative editor where multiple users edit a document simultaneously with eventual consistency. The system must handle: concurrent edits from multiple clients, real-time synchronization, undo/redo stacks per user, conflict resolution via Operational Transformation (OT), permission-based access control (view/edit/comment), and audit trails. Key entities include Document, User, Cursor, Operation, Permission, and Event. Critical challenges: designing an immutable Operation representation that supports composition and transformation, managing causality and vector clocks, preventing God objects by separating concerns (persistence, sync, conflict resolution, UI state), and ensuring the conflict resolution strategy is pluggable. Edge cases: network partitions, simultaneous insertions at the same position, deleted content references, permission changes mid-edit, and recovering from crashed clients.
Practice this question step by step with an AI interviewer that reviews your requirements, your architecture and your trade-offs, and scores the design.