KatInterview

Design a Table Booking Platform

System DesignModel answer
MediumModel answerSystem Designdistributed-systemsconcurrencydatabases

Last updated

Design a scalable system for booking dining tables that handles concurrent requests and prevents conflicts.

You're building a platform that lets diners reserve tables at restaurants. The system needs to support searching for dining options, checking availability, making reservations, and cancellations.

Core Features

Your system must support:

  1. Discovery: Diners search for restaurants by location, food type, and dining time
  2. Availability checking: Users see open time slots for a particular venue and party size
  3. Booking: Reserve a table for a specific group size and time
  4. Cancellation: Remove existing bookings

Technical Constraints

  • Strong consistency for reservations—the same slot cannot be given to multiple parties
  • Handle traffic spikes during popular dining hours (lunch/dinner rushes)
  • Fast search with minimal lag for browsing and filtering

What to Cover

Provide a complete architecture covering:

  • REST endpoints for search, booking operations, and cancellation
  • Database schema showing how you track table state and availability
  • Concurrency mechanisms to ensure two simultaneous requests don't claim the same slot
  • Infrastructure choices including caching layers, load distribution, and storage systems

Focus on the booking consistency problem—how you guarantee atomicity when multiple users compete for limited inventory.

Hints

Hint 1

Think about whether users book specific tables or just capacity slots—this affects your data model

Hint 2

Consider a two-phase approach: temporarily hold a slot while collecting user details, then confirm

Hint 3

Use database row-level locking or versioning to handle race conditions on the same table