Design Anchored Comment Threads on Text Ranges in Google Docs
Last updated: November 29, 2026
Quick Overview
Design the comments feature in Google Docs: comment threads attached to a text range that stay anchored while collaborators edit, with replies, resolve, mentions with assignments, and notifications.
0
0
0 solved
Design the comments feature in Google Docs: comment threads attached to a text range that stay anchored while collaborators edit, with replies, resolve, mentions with assignments, and notifications.
Comments look simple but the anchor must survive concurrent edits handled by the document's operational transform engine, and comments have their own permissions and notification flows. Google interviewers use it to see whether candidates connect the comment system to the editing model correctly.
What the Interviewer Expects
- Explain how anchors are represented relative to document content
- Transform anchors through concurrent edits
- Separate comment storage from the document body
- Handle mentions, assignments and email notifications
- Deal with anchors whose text is deleted
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- What happens to a comment when its whole range is deleted and then undone?
- How do comment permissions differ from edit permissions?
- How do you load a document with 5,000 comments quickly?
- How do suggestions (suggested edits) relate to comments?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: select text, add a comment; reply; resolve and reopen; mention or assign someone (they get email and can reply from email); comments visible to anyone with comment access; anchor follo...
High-Level Design
- Document service: holds the document model and the OT revision log.
- Comment service: stores threads
(thread_id, doc_id, anchor, status, created_by)and messages `(thread_id, msg_id, auth...