KatInterview

Backend Design for a Offline-Capable, Cross-Device Scheduling App

System DesignModel answer
MediumModel answerSystem Designsystem-designsyncconflict-resolution

Last updated

Design the backend for a scheduling app where one user's devices stay in sync, edits work offline, and repeating events are stored and queried efficiently at 10M daily users.

Backend Design for an Offline-Capable, Cross-Device Scheduling App

You are asked to design the server side of a personal scheduling product, comparable to a mainstream online calendar. Each person may use several devices (phone, tablet, laptop), and all of them must show the same data.

What the product must do

  • Create, edit, and remove events.
  • Support repeating events, such as "every Monday morning".
  • Show the events that fall inside a chosen window, such as the current week.
  • Propagate changes made on one device to the user's other devices.

Quality goals

  • Highly available, with strong guarantees on what a user sees after their own changes.
  • Fast retrieval when a user opens or flips through the calendar.
  • Offline-first: edits made without connectivity are queued and merged once the device reconnects.

Scale assumptions

  • 10 million daily active users.
  • Each user has on average about 50 events per month.

What your answer should cover

  1. Data model: the schema for events, including how repeating rules and time zones are represented.
  2. API: the main REST or gRPC endpoints, including how devices sync.
  3. Conflict handling: a strategy for when two devices change the same event while offline.
  4. Scalability: how you serve a read-heavy workload, especially calendar views.

Include a high-level architecture description, with emphasis on the choice of database and the caching layers. Back your choices with rough capacity estimates.

Hints

Hint 1

Start with numbers: estimate read QPS versus write QPS, and storage. Reads will dominate, which shapes the cache and database choices.

Hint 2

For time zones, think about what 'every Monday at 9am' should do across a daylight-saving change. What must you store to keep it correct, and what can be derived for indexing?

Hint 3

Decide whether to store the repeating rule, every occurrence, or both. Consider what happens with infinite series and with editing a whole series versus one occurrence.

Hint 4

Because the server can order all writes for a user's calendar, ask whether you need vector clocks at all. Think about per-record version numbers, a change log with a cursor, and optimistic concurrency.