Katkat

Design a Shared Calendar Service

NotionSoftware Engineer · Onsite

Last updated

This problem tests the ability to design a scalable shared calendar system with support for recurring events, granular permission models, and notification scheduling.

Problem Statement

Design a shared calendar service similar to Google Calendar or Notion Calendar. Users should be able to create events, invite other users, set recurring patterns (e.g., weekly meetings), and receive reminders.

Functional Requirements

  1. Users can create, update, and delete events.
  2. Support for recurring events (e.g., "every Monday at 9 AM").
  3. Users can share their calendars with others with varying access levels (read-only, edit, manage).
  4. System must send notifications/reminders before events start.

Non-Functional Requirements

  1. High availability for viewing calendars.
  2. Low latency for event retrieval.
  3. Support for complex recurrence patterns (rrule).

Scope of Response

  • Define the database schema (consider how to handle recurrence: should you store every instance as a row or store the rule?).
  • Design the high-level architecture and storage strategy.
  • Describe how you would handle conflict detection (e.g., booking a room already in use).
  • Explain how the reminder system scales for millions of users.

Hints

Hint 1

Consider the trade-offs between 'denormalizing' recurring events into individual rows versus storing a single recurrence rule and computing occurrences on the fly.

Hint 2

Think about how to use a partitioned database or caching strategy (e.g., Redis) to speed up read-heavy operations like rendering a monthly view.

Hint 3

For reminders, consider an asynchronous worker pattern using a message queue to process notifications based on event start times.

Follow-up questions

  • How would you handle time zone shifts when a user travels and the server/user is in a different offset?
  • If you have thousands of participants in a single event, how do you optimize the invitation and notification process?
  • How would you implement a 'Find a Time' feature that suggests slots based on the availability of multiple users?