Shared Task Board with Live Sync: Architecture Walkthrough
System DesignModel answerLast updated
Design a backend for team task lists where members add, assign, schedule, reorder and complete items, with changes appearing live across web and mobile and surviving offline use.
Design the backend for a shared task-list product. Teammates create lists together, then add, edit, assign, schedule, reorder, and complete tasks. Everyone with the list open should see changes appear almost immediately, on both web and mobile.
Required capabilities
- Create a list and share it with other people.
- Add and edit tasks.
- Assign a task to a person and set a due date.
- Reorder tasks within a list.
- Mark tasks done or not done.
- Show other collaborators' changes live.
Scale and constraints
- Millions of registered users, with tens of thousands of people active at the same moment.
- Most lists hold tens to low hundreds of tasks. A small number of "hot" lists have many simultaneous editors.
- Soft latency goal: a change made by one connected user is visible to another connected user in roughly 500 ms or less.
- Mobile clients drop offline or have flaky connections.
- No silent data loss, and shared workspaces need an auditable record of who changed what.
- Offline editing, notifications, and comments are nice-to-haves if time allows. Core CRUD, live sync, and permissions are mandatory.
What to cover in your answer
- Clarifying questions you would ask and the assumptions you pick.
- Data model and partitioning.
- APIs and the read and write paths.
- Live synchronization, including reconnect and catch-up.
- How concurrent edits and reordering converge.
- Permission model.
- Consistency trade-offs, scaling, reliability, and the metrics you would monitor.
Hints
Hint 1
Decide the granularity of conflict resolution first: whole task, individual field, or characters inside a description. Most of the design follows from that choice.
Hint 2
Give each list a monotonically increasing version or sequence number. A single ordered log per list makes live push, resume-after-disconnect, and audit history all the same mechanism.
Hint 3
Reordering is the tricky conflict. Think about positions that can be inserted between two neighbors without renumbering everything, such as fractional keys, and what happens when two users pick the same slot.
Hint 4
Separate the durable write (transaction that updates state and appends to the log) from fan-out (publish after commit via an outbox), and make mutations idempotent with client-generated IDs.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Requirements and assumptions
Clarifications I would ask, and my defaults
- Text granularity: assume field-level conflict handling is enough. Task titles are short, so last-writer-wins per field is acceptable. Long descriptions with character-level co-editing are out of scope for v1 and could later be a CRDT-backed text field.
- Roles: owner, editor, commenter, viewer, set per list (with optional workspace-level defaults).
- Offline: edits made offline are queued and replayed. They must never be silently dropped, but they may lose a field-level conflict, and the user is told when that happens.
- Audit: keep history for at least 1 to 2 years.
Targets: p99 write acknowledgement under 200 ms, end-to-end propagation under 500 ms for connected clients, no acknowledged write lost, availability around 99.95%.
Rough sizing: 50k concurrent connections, a few edits per active user per minute gives roughly 1-3k writes/s average, with fan-out multiplying that by the number of viewers per list (typically under 10). This is modest; the hard parts are correctness and hot lists, not raw throughput.
2. Data model
Relational store (for example Postgres), sharded by list_id, since nearly every operation is scoped to one list.
users(id, ...)lists(id, workspace_id, title, owner_id, version, created_at), whereversionis the per-list sequence counter.memberships(list_id, user_id, role), primary key(list_id, user_id).tasks(id, list_id, title, assignee_id, due_at, done, position, deleted, field_versions...)changes(list_id, seq, actor_id, op_id, op_type, payload, ts), primary key(list_id, seq). This is the append-only log.comments(id, task_id, author_id, body, ts).
tasks is the materialized current state for fast reads. changes is the source of truth for history, sync, and audit. Both are written in the same transaction so they never disagree. Deletes are soft (tombstones) so that late-arriving edits resolve cleanly.
3. APIs
- REST/RPC:
POST /lists,POST /lists/{id}/members,GET /lists/{id}(snapshot plus currentseq), andPOST /lists/{id}/opsaccepting one or more operations. - Real-time: a WebSocket (SSE as fallback) where the client sends
subscribe(list_id, last_seq)and receives ordered change events.
Every operation carries a client-generated op_id (UUID) for idempotency.
4. Write path
- Gateway authenticates the token.
- Permission check: role for
(list, user)allows this op type (cached, invalidated on membership change). - Open a transaction on the list's shard: dedupe on
op_id, lock the list row, incrementversion, apply the op totasks, insert intochanges. Commit. - An outbox row, or a change-data-capture stream on
changes, publishes the event to a pub/sub topic keyed bylist_id. Publishing after commit via the outbox means no event is lost if the process crashes between commit and publish. - Realtime nodes subscribed to that topic push to every connected client of the list, including the author (as the authoritative confirmation with its
seq).
Serializing per list via the version counter gives a total order per list at trivial cost, because lists are small and write rates per list are low.
5. Real-time sync and catch-up
- On open: fetch a snapshot at
seq = N, then subscribe fromN. Buffer events during the fetch to avoid a gap. - On reconnect: send
last_seq. The server replayschangeswhereseq > last_seq. - If the log was compacted past
last_seq, or the gap is large, the server returns "resync" and the client reloads a fresh snapshot. Retain the raw log for a window (say 30 days) and archive older audit data to cold storage. - Clients detect gaps by checking that
seqincreases by exactly one and re-request if not. - Connection routing: a stateless realtime tier; each node subscribes to topics only for lists that have a local connection. Use consistent hashing or a pub/sub broker such as Redis Streams or Kafka for node-to-node distribution.
6. Concurrency and ordering
Per-field last-writer-wins, ordered by the server's seq. Two users editing different fields of one task both succeed. Two users editing the same field resolve to the later seq. This is simple, deterministic, and adequate for titles, assignees, due dates, and done flags. Clients apply edits optimistically, then reconcile when the server's ordered event arrives (rebase).
Completion and deletion: done is a boolean with LWW. Delete wins over concurrent edits (tombstone), and the UI offers undo.
Reordering: store position as a fractional rank (or a LexoRank-style string). To move a task, compute a key between its new neighbors. Only that one row changes, so concurrent moves of different tasks do not conflict. If two users produce identical keys, break ties with (position, task_id) and occasionally rebalance a list in a background op when keys grow too long. This avoids renumbering N items per move.
When to use CRDT/OT: only for true co-editing of long text inside a description. Introducing it everywhere adds complexity and storage with little benefit for tiny structured records. If needed, scope it to that single field.
Offline: the client queues ops with their op_ids and the base seq. On reconnect it submits them; the server applies them under normal LWW rules and returns any ops that lost, so the UI can show "your change to X was overwritten by Y." Nothing is dropped silently because every attempt is in the audit log.
7. Permissions
Check authorization on every op, server-side, never trusting the client. Roles: viewer (read), commenter (read plus comment), editor (task mutations), owner (membership and deletion). Revoking access must also close or filter active subscriptions, so the realtime tier listens for membership-change events and drops that user's subscription immediately. Link sharing uses signed, revocable tokens that map to a role.
8. Consistency trade-offs
- Strong, per list: writes serialize through the list's shard, giving a total order and read-your-writes for the author.
- Eventual across clients: others see changes within the propagation window.
- Cross-list queries ("all my assigned tasks") are served from a secondary index or search store updated asynchronously from the change stream, accepting a few seconds of lag.
9. Scaling and hot lists
- Shard by
list_id. Cache active list state in memory (Redis) and read snapshots from there. - Hot lists: coalesce rapid events into small batches (for example 50 ms), throttle presence and cursor updates, and cap fan-out per node with back-pressure. Slow clients get dropped to snapshot-resync rather than letting queues grow without bound.
- Rate-limit per user and per list to contain abusive clients.
10. Reliability and observability
- Idempotent ops, outbox publishing, and at-least-once delivery with client dedupe by
seqgive effectively exactly-once behavior. - Encrypt in transit and at rest; replicate the database across zones; test failover.
- Metrics: commit-to-delivery latency (p50/p99), change-stream lag, connected sockets, reconnect and resync rates, rejected or rebased op rate, per-shard write latency, outbox backlog.
Common mistakes
- Saying "use CRDTs" with no justification or scope.
- Renumbering all positions on every reorder.
- Publishing to clients before the transaction commits, causing phantom updates.
- Forgetting to revoke live subscriptions when a member is removed.
- No plan for reconnect after the log is compacted.
- Treating offline replay as simply overwriting server state.