KatInterview

Build a Table Booking Platform for Many Restaurants

System DesignModel answer
MediumModel answerSystem Designsystem-designconcurrencydata-modeling

Last updated

Design a multi-restaurant table booking backend that prevents double-booking, serves fast availability queries, survives peak-hour spikes, and keeps a full audit trail.

Task

You are asked to design the backend for an online table booking platform that serves many independent restaurants. Guests use it to find open times and reserve a table. Restaurant staff use it to configure their venue and run service.

What guests must be able to do

  • Check which times are open for a chosen date, time and party size.
  • Make a booking by providing a name, contact details, party size, desired time and optional notes.
  • Change or cancel an existing booking.
  • Get a confirmation right after booking and reminders before the visit, via email, SMS or push.

What restaurants must be able to do

  • Create and edit a restaurant profile, opening hours, and closed days (holidays, private events).
  • Define the table inventory: table identifiers, seating capacity, and which tables may be pushed together for larger parties.
  • See upcoming bookings and mark each as seated, completed or no-show.

Non-functional requirements

  • Correctness first: the same table must never be promised to two parties for overlapping times.
  • Fast reads: availability lookups should have a p95 latency of roughly 200-300 ms.
  • Traffic spikes: lunch and dinner peaks, and sudden demand for popular venues, must be absorbed.
  • Traceability: every change or cancellation should record who did it, and write APIs must be safe to retry.

Assumptions to state in your answer

  • The platform hosts many restaurants.
  • A booking occupies a table for a fixed length of time (default 90 minutes, configurable).
  • All scheduling is timezone-aware.

What your answer should cover

  1. Back-of-the-envelope scale estimates.
  2. Data model (tables, bookings, temporary holds, time slots or ranges).
  3. APIs and the main flow: search availability, book, confirm, remind.
  4. The concurrency strategy that prevents double-booking, with alternatives and trade-offs.
  5. Scaling and caching approach.
  6. Edge cases: cancellations, no-shows, walk-ins, combined tables, overbooking and waitlists.

Hints

Hint 1

Put numbers on the problem first (restaurants, bookings per day, read-to-write ratio, peak multiplier). They show that availability search is the hot path while writes are modest and shardable by restaurant.

Hint 2

Model time as a range per table rather than pre-generated slot rows, and let the database enforce that active ranges for the same table cannot overlap. Compare this against slot rows with a unique key, row locks, and distributed locks.

Hint 3

Treat the cache as a hint only: the booking transaction is the source of truth. Think about idempotency keys, short-lived holds, an outbox for notifications, and how DST and local opening hours affect slot generation.