KatInterview

Design a Distributed Scheduling and Calendar Platform

System DesignModel answer
HardModel answerSystem Designdistributed-systemsdata-modelingfrontend-architecture

Last updated

Design a calendar system for millions of users covering event storage, recurring rule expansion, time zone correctness, and a responsive frontend with optimistic updates.

Prompt

You are building a collaborative scheduling platform — think of it as a calendar service used by millions of people to create meetings, block time, and coordinate with others. Your task is to walk through the key design decisions an engineering team would need to make before writing a line of code.

What the system must do

  • Users can create, edit, delete, and view calendar events.
  • Events can recur on a schedule (e.g., "every Tuesday and Thursday at 2 PM").
  • A user can query another user's free/busy status to find an open slot.
  • Users receive reminders before an event begins.

Quality requirements

  • Calendar reads (viewing the week, loading events) must be fast and highly available.
  • Meeting bookings must not double-book a time slot — consistency matters there.
  • The system must correctly handle participants spread across different time zones.

Your deliverables

Address each of the following areas in your answer:

  1. API design — what are the core endpoints? How do you handle safe retries and concurrent edits?
  2. Data model — how do you store events and recurrence rules? How do you make range queries efficient without expanding an infinite series at read time?
  3. Frontend strategy — how does the browser client manage local state, handle optimistic updates when a user creates an event, and stay in sync with the server?
  4. Scaling hot calendars — a public figure or a shared room resource may have thousands of simultaneous viewers. How do you serve them without hammering the database?

You do not need to design email delivery, video conferencing integration, or external calendar sync (iCal import/export).

Hints

Hint 1

For recurring events, storing only the rule and expanding lazily at read time hurts free/busy queries across many users. Storing fully pre-expanded rows breaks on infinite series and makes edits expensive. Think about a middle path: materialize instances up to a rolling horizon and fall back to on-demand expansion beyond it.

Hint 2

Storing event times in UTC is correct for point-in-time instants, but a weekly recurring meeting defined in a specific city must keep its IANA time zone name alongside the rule — otherwise it drifts by an hour after a daylight saving transition. The two concerns are different and need to be stored separately.

Hint 3

For optimistic UI updates, the hard part is not applying the change locally — it is handling a conflict when the server rejects it. Think about what you store in a client-side outbox, what a version or ETag gives you, and what the user should see when a slot was taken by someone else a moment earlier.