Skip to content

How to design a to-do app (frontend)

The first sections are free. The deep dives, level expectations and quiz are part of Pro.

On this page
Asked at
Practice this question

The problem

A web client for lists of tasks that someone adds, edits, ticks off and drags into order, kept in step with the same lists on their phone and laptop. The answer turns on one fact: the screen has to change before the server has agreed, so the client needs a store it can roll back, a change id on each edit so a retry is harmless, and a way for each device to ask what changed since it last looked instead of reloading everything.

Clarifying questions

AskWhy it mattersA typical answer

Is each list private to one person, or shared with others?

A private list means conflicts come from the same person on two devices, which is rare and can be settled simply. A shared list makes concurrent edits common and changes how much merging the client must do.

Private today: one person, several devices. Sharing a list with other people is out of scope, though it is a natural closing question.

How long can a list get, and does the order matter?

A list that sorts by date has no reorder problem at all. A manually ordered list sizes how much a single drag must save, and whether the list needs virtualization.

Up to 300 active tasks in one list, in an order the person chooses by dragging or with the keyboard.

What does the server give me: a plain task API, or a sync API with tokens and a push channel?

If the server can hand back changes since a token and nudge clients, the client's sync engine is small. If it offers just per-task endpoints, with no changes-since call and no push, the client is left polling and has to work around a reload limit.

Both: a PATCH per task for simple cases and a /sync endpoint that takes a batch of changes and returns what changed since a token. The server can also send a nudge over a push channel.

Does it have to work with no connection, or just survive a patchy one?

Full offline use means a local database as the source of truth and a plan for long-queued changes. Surviving a bad signal means a change queue that persists and flushes when the connection returns.

Survive a patchy connection: an edit on the train must not be lost, and must reach the laptop when the phone reconnects. A fully offline product is a variant, not the core.

How fast does a tick or a drag need to feel, and how fast should the first tasks appear?

These two numbers decide whether the client can wait for the server before painting, and whether the first paint can depend on a network call.

A tap or drag answers within 200 milliseconds, and the first tasks show within 2.5 seconds.

Are reminders, repeating tasks, attachments or comments in scope?

Each is a product of its own: repeating tasks need date rules, attachments need uploads, and reminders need a server-side scheduler. Any of them can swallow the round.

All out of scope. The round is about the list itself: add, edit, tick, reorder, and keeping devices in step.

The requirements menu

RequirementScopeWhy

Add, edit and delete tasks in a list

Core

The basic loop of the product. Each one is a change the client shows at once and sends later, so the design for adding covers the rest.

Tick a task off, and back on

Core

The change this guide uses to show how the client handles a refusal. Unticking matters because a quick tick and untick on one task is a burst the change queue has to cope with.

Reorder tasks by dragging, or with the keyboard

Core

Manual order is what separates this from a sorted list, and the keyboard path is a stated requirement, not a nicety.

See the same lists on every device, with changes made elsewhere

Core

This is where the client earns its sync engine: a token, a change queue and a way to learn of changes without reloading.

Undo a tick or a delete for a few seconds

Optional

Take it if there is time: the snapshot the client already keeps for a rollback is most of what undo needs. Leave it if the core sync path is not finished.

Show completed tasks in a separate section or hide them

Optional

Take it if the interviewer asks what a ticked task looks like a minute later. It changes the list's grouping, not its data flow, so it fits in a sentence.

Due dates, and a view sorted by date

Optional

Take it if the interviewer wants a second view over the same store, which shows the store is normalized. Leave it if the manual order is still being worked out, since two orders on one list confuse the design.

Work with no connection at all, including a first load

Optional

Take it if the interviewer pushes on the train scenario past a patchy signal. It usually means a local database as the source of truth and, on the web, something like a service worker to serve the shell, which is a larger build than a persisted change queue.

Search across all lists

Optional

Take it for a person with many lists, since the normalized store can be filtered without a server call. Leave it if lists are few and short.

Reminders by email or phone

Out of scope

Mostly a server-side scheduler and a delivery channel; the web client would gain a reminder field on a task and little else, and none of the sync design changes.

Sharing a list with other people

Out of scope

Turns rare same-person conflicts into frequent ones and brings permissions and presence. A fair closing question, but not part of the core design.

Repeating tasks

Out of scope

Recurrence rules and time zones are a product of their own, and they change what ticking a task means.

Attachments and comments

Out of scope

Uploads and threads add a storage path and a second kind of change that the task sync does not cover.

Non-functional requirements

RequirementWhat it forces

A tick or a drag answers within 200 milliseconds

The checkbox and the dragged row must repaint from the client store before any network call returns, so a change is applied to the store first and sent afterwards. It also keeps heavy work, such as re-sorting a long list, out of the tap handler.

The first tasks show within 2.5 seconds

The first paint can't depend on a full sync of all lists. Load the open list first, show tasks kept in local storage from the last visit while the fetch runs, and sync the other lists afterwards.

A list holds up to 300 active tasks

A reorder must not write a position to each task below the move, since that would be hundreds of writes for one drag. It also means the list is long enough that re-rendering all rows on each change needs care, though short enough that virtualization is a judgment call rather than a must.

No change is lost or applied twice when a request is retried

Each change carries an id the server remembers, so a retry after a timeout is recognized and skipped. Changes wait in a queue that outlives the request, and the queue is persisted so a page reload on a bad connection does not drop them.

A change on one device shows on another without a manual reload

A sync engine on each device that asks for changes since its last token when the tab becomes visible, when the connection returns and on a nudge from the server, within a reload budget of 100 full fetches per person every 15 minutes.

Core entities

EntityWhat it holds

List

A named collection of tasks with its own place among the person's lists.

Task

One row in a list, with its done state and its position.

Pending change

A single edit the person made that the server has not yet accepted.

Sync state

What this device knows about how far it has caught up with the server.

The API

EndpointNotes

GET /lists/{id}/tasks → { tasks, sync_token }

The first load of a list. The token that comes back is the starting point for incremental syncs; the client stores it with the list.

POST /sync { sync_token, changes: [{ change_id, type, args, temp_id }] } → { results by change_id, id map, changes since, sync_token }

The main write path. The client sends its pending changes in order, each carrying an id of its own; the server answers per change (accepted or an error), maps temporary ids to real ones, and in the same response returns what changed elsewhere since the token. One round trip both pushes and pulls.

GET /sync?since={sync_token} → { changed tasks, deleted ids, sync_token }

The catch-up read, used when the tab regains focus, when the connection returns and after a server nudge. It is far cheaper than reloading lists, and it is the call that keeps devices under the full-reload limit.

PATCH /tasks/{id} { done | title | order_key } with a Change-Id header → task

A single-field write for the simple case. The header carries the same change id the queue holds, so a retried PATCH is recognized as a repeat rather than applied twice.

The high-level design

editsrenderPATCHtasksTask list viewClient storeServer

Step 1 of 4

View, store, server

Start with the smallest client that works: the task list view reads from a client store that holds tasks by id and each list as an ordered array of ids, and the store talks to the server directly. A tick writes PATCH /tasks/{id} and the store updates when the answer comes back. It shows the data flow, and it already fails the brief: on a slow connection the checkbox does not change for as long as the request takes, well past the 200 milliseconds a tap gets, and a refusal has nothing to undo because nothing was shown.

editsrenderchangesendresultsrefusednudgesincechangesapplypersistpersistTask list viewClient storePending changesServerFocus or onlineSync engineLocal storage
The whole design

What breaks first

The deep dives

Ticking a task off at once, and the server saying no. Someone on a slow phone connection ticks a task. The server takes a while and then refuses, because the task was deleted on another device. What do they see at each moment, and what does the client do with the change it already showed?

A concept that helps here: Optimistic updates and rollbackA concept that helps here: Sync queues and client idempotencyA concept that helps here: Partial failure in the UI

Reordering. Someone drags the last task of a 300-task list to the top on their phone while the same list is open on their laptop. What does the client send, how many tasks change, and what does the laptop show?

A concept that helps here: Drag and drop, and keeping orderA concept that helps here: Accessible widgetsA concept that helps here: Conflict resolution on the client

The same list on two devices. Someone renames a task on their phone on a train with a patchy signal while the same list is open on their laptop at home. How does the laptop find out, what happens to the edit while the phone has no signal, and what if both devices changed the same task?

A concept that helps here: Reconnect and resumeA concept that helps here: Sync queues and client idempotencyA concept that helps here: Conflict resolution on the client

Concepts this guide uses

Sources

  1. Rollout: Todoist API essential guide (rate limits for full and partial sync)
  2. Scalekit blog: Todoist MCP vs Todoist API for AI agents (command uuid idempotency, temp_id, sync_token)
  3. pkg.go.dev: todoist-api-go sync package (Command with uuid and temp_id)
  4. Todoist help: Usage limits in Todoist
  5. Microsoft Graph: todoTask delta
  6. Microsoft Graph: Use delta query to track changes
  7. Microsoft Q&A: Graph delta API, delta token expiration and handling 410 resyncRequired
  8. TanStack Query: Optimistic updates
  9. Figma blog: Realtime editing of ordered sequences
  10. web.dev: Interaction to Next Paint (INP)
  11. web.dev: Web Vitals
  12. W3C ARIA Authoring Practices Guide: Example listboxes with rearrangeable options
  13. MDN: Page Visibility API
  14. MDN: Navigator: onLine property
Sign in to report a mistake