Skip to content

How to design Google Calendar

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

On this page
Practice this question

The problem

Google Calendar keeps people's events, repeats them on a rule, puts one meeting on many calendars in many time zones, answers who is free when, and fires reminders. People open their calendars far more often than they change them, and a weekly meeting with no end date has no last occurrence to write, so the answer turns on storing a series as one rule plus its exceptions in the organizer's own time zone, and moving the heavy work (expanding occurrences, fanning an edit out to hundreds of calendars, finding the reminders due this minute) off the read path or ahead of time.

Clarifying questions

AskWhy it mattersA typical answer

How many people use it, and how do reads compare with writes?

The mix decides where to spend effort. If people mostly look at their week, the read path (expanding series, drawing a view) gets the caching and the indexes, and writes can afford extra work such as updating a busy index.

About 100 million users, mostly reading their calendars. No request rate is given, so state an assumption out loud and move on.

Can a repeating event run with no end date, and can one occurrence be changed on its own?

An endless series rules out writing a row per occurrence, and a changed single occurrence means the design needs exceptions, not just a rule.

Yes to both. A weekly meeting can repeat with no end, and someone can move one Thursday or change this and all following occurrences.

How many guests can one event have, and how many calendars does one availability check span?

Fan-out size decides whether an edit can update attendee calendars inside the request or must go through a queue, and the free/busy cap sizes the work of one availability request.

Up to 100,000 guests on one event, though a typical edit reaches hundreds. One free/busy check covers at most 50 calendars.

Are attendees spread across time zones, and must times survive daylight saving changes?

If yes, the design stores a named time zone with each event rather than a UTC instant or a fixed offset, and expands a series in that zone.

Yes. An attendee abroad must see the right local time, including in the week the clocks change in either country.

How exact must a reminder be: on the minute, and at most once?

On time and once pushes the design toward reminders stored by their due minute and a per-occurrence id that lets the notification side drop repeats.

A reminder fires on time and once. A duplicate or a reminder for a canceled occurrence counts as a bug.

Can people outside the system be invited?

An outside guest has no calendar here, so their path is email, which changes what the fan-out worker does per attendee.

Yes. Outside guests get the invite and any change by email.

Are rooms, search over events and sync with other calendar products in scope?

Each is a system of its own; naming them as out of scope keeps the round on events, series, invites, availability and reminders.

No, all three are out of scope for this round.

The requirements menu

RequirementScopeWhy

Create, edit and delete events with a time, a place and attendees

Core

The base write path. Everything else (series, invites, free/busy, reminders) hangs off an event row owned by one calendar.

Repeat an event, and change one occurrence or all that follow

Core

The part that shapes storage. A rule plus exceptions is cheap to store but costs work on read; the edit scopes decide how exceptions and series splits work.

Invite people, who accept or decline and see the event on their own calendar in their own time zone

Core

Puts one event on many calendars, which forces a decision on fan-out and on who owns the time of a shared event.

See when a group of people is free or busy

Core

A read across many calendars at once, with privacy rules, and the place where long series make a request expensive.

Get a reminder before an event, as a notification or an email

Core

Timed delivery at scale: millions of reminders can fall due in the same minute, and each must fire once.

Invite guests from outside the company by email

Optional

Worth taking: Google Calendar does it, and it costs one branch in the fan-out worker. Leave it if the interviewer wants the round on internal calendars.

Working hours and a default time zone per person

Optional

Cheap to add on the calendar row and useful for free/busy (skip slots outside someone's working day). Take it if availability becomes the focus.

Push each change live to open devices

Optional

Tempting for a snappy feel, but incremental sync on open or on a timer covers most reads. Mention it, and say you'd add a push channel later if people complain about stale views.

Attachments and video-call links on an event

Out of scope

Metadata on the event row and a call to another product. Nothing in the hard parts depends on it.

Offline edits on the phone that merge later

Out of scope

A client-side sync problem with its own conflict rules. Name it and keep the server design the subject.

Meeting rooms and resource booking

Out of scope

A room is a calendar that can't double-book, which adds a locking problem. Say it would be a calendar with a stricter clash check and park it.

Search over events

Out of scope

Needs its own index over titles and descriptions. Say how changes would feed it and move on.

Sync with other calendar products

Out of scope

Import and export of calendar files and two-way sync with another vendor is a separate integration effort.

Non-functional requirements

RequirementWhat it forces

About 100 million users, with far more reads than writes (Google report)

Partition events by calendar so a week view is one range read on one partition, and spend the design effort on the read path: cached expansions for busy calendars, a busy index for availability. Writes can afford extra work, such as updating that index.

Conflict and free/busy checks answer fast enough to feel interactive

An availability request across up to 50 calendars shouldn't expand each series of each person on the spot. Keep busy intervals for the coming weeks ready per calendar, so the request reads and merges intervals instead of computing them.

Times stay right across time zones and daylight saving changes

Store each event's local start and end with a named time zone (a zone name such as America/Los_Angeles, not a fixed offset), expand a series in that zone, and convert per viewer at read time. Keep the zone rules in a database you can update when a government changes them.

A reminder fires on time, and only once

Reminders are stored by the minute they fall due, not found by scanning events. Delivery may repeat after a crash, so each send carries a key built from the reminder and its occurrence and the notification side drops a second copy; a worker also rechecks the event before sending in case it moved.

An organizer’s change reaches every attendee’s calendar

One copy of the event is the truth, and it lives on the organizer's calendar. A change is fanned out through a queue to each attendee's entry with idempotent writes, so a retry after a crash does no harm, and devices catch up with an incremental sync.

Estimates

QuantityWorkingResultWhat it sizes

Rows if a weekly series were written out one row per occurrence

52 occurrences a year per weekly series; the interviewer's assumption is about 100 million people each keep one such series: 100 million × 52 ≈ 5.2 billion rows a year, and about 52 billion over ten years, with no end date to stop the growth

About 5.2 billion new rows a year from weekly series

The storage and write cost of writing occurrences out, which is why a series is stored once as a rule and expanded for the range a view asks for.

Attendee writes for one edit of the largest allowed event

One event may have up to 100,000 guests, so one time change means 100,000 attendee-entry updates. As an example only, if each write took about 1 ms and they ran one after another inside the request, the request would wait about 100 seconds; a typical edit reaching hundreds of attendees would still wait hundreds of milliseconds

Up to 100,000 writes per edit, about 100 seconds if done inline one by one under that example assumption

Why the fan-out leaves the request: the organizer's save writes one row and enqueues one message, and workers update attendee entries behind it.

Reminders due in the busiest minute

An example assumption, not a target: one in ten of the 100 million users has a Monday 9 AM meeting with a ten-minute reminder, so 10 million reminders fall due in the 8:50 minute; spread across the 60 seconds of that minute, that is about 167,000 sends a second

About 10 million reminders in one minute, roughly 167,000 a second averaged over it

The number of partitions the due-reminder buckets need and the send rate the notification service must take; a scan of the events table each minute is out of the question at this rate.

Intervals one availability request at the cap must merge

At most 50 calendars per query over a one-week window; as an example assumption, 30 busy blocks per calendar per week gives 50 × 30 = 1,500 intervals to collect, sort and merge, after expanding each series that touches the week

About 1,500 intervals per request at the cap, each from an expansion if nothing is precomputed

The work a free/busy request does when it expands on the spot, and what a per-calendar busy index saves.

Core entities

EntityWhat it holds

Calendar

One per person or team: who owns it, its default time zone, and who may see what.

Event

A single meeting or the head of a series; the organizer's calendar holds the one copy that counts.

Exception

One occurrence of a series that was moved, changed or canceled.

Attendee

A person's entry for an event: their own calendar's view of it plus their answer.

Reminder

What a person asked to be told, how long before, and by which method.

Due reminder

A reminder resolved to the minute it fires for one occurrence, ready for a worker to claim.

Busy interval

A precomputed busy block on one calendar, kept for the coming weeks so availability reads don't expand series.

The API

EndpointNotes

POST /calendars/{id}/events { start, end, time_zone, recurrence?, attendees? }

Start and end are wall-clock times in time_zone, a zone name such as America/Los_Angeles. recurrence holds RRULE, RDATE and EXDATE lines; the series is stored once and not expanded on write. Attendees are written as entries on their own calendars by a fan-out worker after the request returns, so a list of hundreds doesn't hold the save. Returns the event id and, for large lists, a status the client can poll.

GET /calendars/{id}/events?from=&to= → events, with repeats expanded in the range

One range scan on the calendar's partition for single events, attendee entries and series heads, then the expander produces occurrences inside the window, applies exceptions and converts each to the viewer's zone. Busy calendars answer from a cached expansion of the window.

PATCH /events/{id}?scope=this|following|all

this writes an exception keyed by the occurrence's original start. following ends the series just before the chosen occurrence's original start and creates a new series from that occurrence, instead of writing one exception per remaining occurrence. all edits the series row. Each scope bumps the event version and enqueues one fan-out message.

POST /events/{id}/response { yes | no | maybe }

In this design, the response is written on the attendee's own entry and then copied back to the organizer's attendee list through the same fan-out path, so the organizer's view of who is coming stays current; the response is the one attendee change that flows back, and the shared time is not touched, so an attendee can't move a meeting for everyone.

POST /freebusy { calendars, from, to } → busy intervals per calendar

Checks that the caller may see at least free/busy on each calendar, rejects more than 50 calendars, and reads the busy index for the window. Returns intervals with no titles, in UTC or a zone the caller names; the client intersects the gaps across people.

The high-level design

callsscanWeb and phoneEvent serviceEvents

Step 1 of 4

One service over events partitioned by calendar

Start with the read path, since that is where the load is. Web and phone clients call an event service, which reads and writes one store of events partitioned by calendar id, so a week view is one range scan on one partition. A repeating event is one row holding its rule and its time zone, plus a small set of exception rows for moved or canceled occurrences; the service expands the rule into occurrences for the window the client asked for, applies the exceptions and converts each occurrence to the viewer's zone. Nothing is written per occurrence, so a series with no end date costs the same as a single event to store.

callsslotsscanchangeintervalsreadentriesscheduleclaimsendWeb and phoneEvent serviceAvailabilityEventsFan-out queueBusy indexAttendee updaterDue remindersReminder workersNotifications
The whole design

What breaks first

The deep dives

Repeating events and time zones. A weekly 9 AM meeting repeats with no end date, someone moves one Thursday, and an attendee in another country opens their week view in the week their clocks change. What is stored, and how does the view get drawn?

A concept that helps here: Core entities and the data modelA concept that helps here: Caching strategies

Invites across calendars. An organizer invites hundreds of people to a weekly meeting and then moves it by an hour. How does the new time reach each attendee's calendar and phone, what do attendees see in the meantime, and what happens if the updater fails halfway?

A concept that helps here: Fan-out on write and on readA concept that helps here: Idempotency keysA concept that helps here: Retries and dead-letter queues

Finding a free slot. Someone needs a free hour next week for eight people in four time zones, several of whom keep long repeating series. How does the request become a list of open hours, what does it cost, and what if one of the eight books something while the list is on screen?

A concept that helps here: Change data captureA concept that helps here: Authorization modelsA concept that helps here: Consistency models

Reminders on time. Millions of meetings start at 9 AM on Monday, each with a reminder ten minutes before. How does each reminder fire at 8:50, once, even when a sender crashes mid-minute, and what stops one firing for an occurrence that was moved or canceled?

A concept that helps here: Job scheduling and delayed workA concept that helps here: Delivery semantics: at most, at least, exactly onceA concept that helps here: Idempotency keys

Concepts this guide uses

Sources

  1. Google Calendar API: recurring events
  2. Google Calendar API: synchronize resources efficiently
  3. Google Calendar API: Freebusy query
  4. Google Calendar API: reminders and notifications
  5. Google Calendar API: calendar sharing
  6. Google Calendar API: calendars and events
  7. Google Calendar API: invite users to an event
  8. Google Workspace Updates: improvements for scheduling large scale meetings on the web
  9. IETF RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)
  10. IANA: Time zone and daylight saving time data (tz-link)
  11. Wikipedia: tz database
  12. System Design Academy: Design Google Calendar
Sign in to report a mistake