Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 28

Design a hotel booking system

Intermediate · 40 min · Transactions & inventory

Guests search a property for a date range, compare room types and confirm a stay. Each hotel decides how many rooms of each type it sells per night, and selling one more than that means walking a guest to another hotel at your expense.

Requirements

  • Search availability by property, room type and date range.
  • Reserve one room of a type for every night in a stay, or fail the entire booking.
  • Cancel a reservation and return its nights to inventory.
  • Make booking and cancellation retries safe: a retried request never creates a second reservation or releases nights twice.

Constraints and assumptions

  • 50,000 properties with about 6 room types each. Inventory is tracked per room type per night and sellable 365 days ahead.
  • Peak load is about 1,000 searches per second and 20 booking attempts per second.
  • Stays are 1 to 14 nights. The checkout day is not a night of the stay.
  • Search results may be up to a minute stale; a confirmation must never oversell.
  • A booking confirmation should complete in under one second at p99.

Out of scope for the first sketch

Payments and card holds · Assigning specific room numbers · Dynamic pricing and rate plans · Reviews and photos

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches