Design a Room-Type Hotel Booking System
Design a hotel search and reservation service that sells room-type inventory without overselling concurrent stays.
Problem statement
For this exercise, assume guests search properties and room types for a half-open stay interval, reserve one room-type unit, and later inspect or cancel the reservation. An upstream property feed supplies the hotel catalog, room types, nightly capacity, and operator closures; designing that feed is outside scope.
A successful reservation atomically consumes one unit of room-type inventory for every night in the stay, and available inventory can never fall below zero.
Create and cancel operations are idempotent, successful reservations receive an immutable confirmation ID, and an eligible cancellation restores future-night inventory exactly once. Exact-room assignment, payments, loyalty, dynamic pricing, housekeeping, check-in, and travel packages are outside scope.
What to build
- Guests can search properties and room types that appear available for a location, guest count, and half-open stay interval.
- Guests can idempotently reserve one room-type unit across every night in a stay and receive one durable confirmation or an explicit sold-out outcome.
- Authorized guests can retrieve the current reservation status and immutable booked interval and room-type details by confirmation ID.
- Guests can idempotently cancel an eligible reservation and restore its future-night inventory exactly once.
At scale
- For this exercise, assume 100,000 properties, with room-type inventory and booking authority naturally partitioned by property.
- For this exercise, assume peaks of 100,000 searches per second and 5,000 reservation or cancellation writes per second.
- For this exercise, target 300 millisecond p99 search responses and 99.99% availability for reservation operations.
- For this exercise, preserve confirmed reservation outcomes through a single-zone failure and fail closed when authoritative nightly inventory cannot be reached.