KatInterview

Build a Multi-Tenant Task Tracker API at Scale

System DesignModel answer
MediumModel answerSystem Designsystem-designrest-apirate-limiting

Last updated

Design a backend for a personal task manager serving millions, covering API contracts and versioning, tenant isolation, per-user throttling, caching, and data partitioning.

Design a Personal Task Tracker Backend

You are asked to design the backend for an application where each person keeps a private list of tasks. The product has millions of users, so it must stay fast and highly available.

What the service must do

  • A user can create a task with a title, a due date, and a priority.
  • A user can list, edit, and remove only their own tasks.
  • The API must be versioned (for example v1 and v2) so that new features can ship without breaking older clients.

Quality attributes

  • Authentication and isolation: Identify callers securely. One user must never be able to read or change another user's data.
  • Throttling: Cap how many requests a single user can send per minute to prevent abuse.
  • Speed: Reading a task list must be quick, especially for data that is requested often.
  • Consistency: Decide where updates must be strongly consistent and where eventual consistency is acceptable.

What to cover in your answer

  1. API contract: Main endpoints, how versions are expressed, and how credentials are sent.
  2. Data model: Schemas for tasks and users, plus how you would partition or shard the data.
  3. Architecture: The main components (gateway, load balancer, cache, datastore, etc.) and how a request flows through them.
  4. Request-time logic: How you would implement rate limiting (for example a token bucket) and how you keep the cache correct when tasks change.

State your assumptions about scale and latency targets before diving into the design.

Hints

Hint 1

Every request touches exactly one user's data. Ask how that single fact can drive your partition key, your cache keys, and your tenant-isolation strategy.

Hint 2

Take the user identity from the verified token, never from the URL or request body. Think about what status code to return when someone asks for a task that belongs to someone else.

Hint 3

For rate limiting, think about an atomic per-user counter in a shared store, and what the system should do if that store is down. For caching, walk through the race where a slow reader writes a stale value back after a writer has invalidated the key.