KatInterview

Design a Real-Time Collaborative Task List

System DesignModel answer
MediumModel answerSystem Designsystem-designwebsocketsreal-time

Last updated

Architect a low-latency, real-time shared task list supporting concurrent edits, item reordering, explicit synchronous durability, and reconnection recovery.

Problem Context

Design the backend architecture for a real-time collaborative task list application (such as shared team checklists or joint planning boards). The system allows multiple users to view, add, modify, check off, delete, and reorder tasks within a list concurrently.

The application must ensure that local modifications are persisted durably and acknowledged directly to the author, while simultaneously broadcasting updates to other active collaborators on the same list with sub-second latency.

Requirements

Functional Requirements

  • Shared Workspace: Users can create lists, manage access control, and receive live updates from active collaborators.
  • Task Management: Support task creation, updating (title, status, assignee), deletion, and relative reordering.
  • Real-Time Push: Active collaborators currently viewing a list must receive remote changes with minimal latency.
  • Durable Acknowledgements: Modifications must be explicitly committed to persistent storage before returning a success acknowledgement to the authoring client.
  • Conflict Handling: The backend must resolve concurrent mutations (e.g., simultaneous field edits or relative item positioning) deterministically without silent data loss.
  • State Catch-up: Disconnected clients must seamlessly resynchronize missing updates upon reconnecting without needing to re-fetch full list state unless necessary.

Non-Functional Requirements & Scale

  • Scale: 10 million Daily Active Users (DAU); 1 million peak concurrent active lists.
  • Group Density: Typically 2–10 active collaborators per list; peak spikes up to 100 concurrent collaborators on a single list.
  • Latency SLAs:
    • Author write durability acknowledgement (p99) < 100ms.
    • Broadcast fan-out latency to active collaborators (p99) < 250ms.
  • Consistency: Strong consistency / linearizability per individual list. Global ordering across unrelated lists is not required.

Deliverables

Provide a complete architectural design covering:

  1. API & Data Representation: API specifications, schema design, task reordering strategy, and versioning primitives.
  2. System Architecture: High-level component diagram detailing the synchronous write durability path versus the asynchronous real-time fan-out tier.
  3. Concurrency Control: Mechanism for handling race conditions, concurrent field edits, and list reordering.
  4. Connection Management & Catch-up: Edge WebSocket routing, pub/sub integration, session state management, and reconnection protocol.

Hints

Hint 1

Differentiate the synchronous persistence path from the asynchronous broadcast path. Synchronous writes require disk flush before responding to the author, whereas client updates can be pushed via lightweight pub/sub.

Hint 2

For task reordering, avoid integer index shifts across the array. Consider string-based fractional indexing (e.g., LexoRank) to make reordering an isolated write.

Hint 3

Avoid putting a message queue like Kafka directly in the write confirmation loop. The author's HTTP/WebSocket ACK must wait on primary storage insertion, while CDC or transactional outbox handles the downstream publish.