MentorNode
Start free
Geo, Maps & MarketplacesHarddesign-booking-system

Design a Hotel & Flight Booking System

Design inventory where overselling is unacceptable: holds that expire, searches across a huge date-and-price space, and a payment step that happens after the seat is already claimed.

Inventory ReservationOptimistic ConcurrencyTwo-Phase BookingIdempotency
Traffic & Capacity Estimates:

10M properties · 100k searches/second · 5k bookings/second · zero overselling

Functional Requirements

  • •Search availability across dates, locations, and prices with faceted filters.
  • •Place a temporary hold on inventory during checkout, expiring automatically if payment stalls.
  • •Confirm a booking atomically with payment capture, or release the hold cleanly.
  • •Support cancellation, modification, and refund against the original inventory.

Non-Functional Requirements

  • •Never sell the same room or seat twice, even under concurrent checkout.
  • •Search results in under 300ms across a very wide parameter space.
  • •Inventory state must be recoverable and auditable after any partial failure.

Back-of-the-Envelope Math

  • 10M properties * 365 dates * 20 room types = 73B availability records — the search index must be denormalized aggressively.
  • Holds at 5k bookings/s with a 15-minute TTL means up to 4.5M live holds at any moment.

Key Architectural Trade-offs

  • Pessimistic locking on inventory rows guarantees no oversell and serializes hot properties; optimistic concurrency with a version check scales and pushes retries to the client.
  • Search reads from a denormalized, slightly stale index while booking writes against the authoritative store — the gap is why 'this room was just taken' exists as a user-facing state.
  • Holds convert availability into a distributed-lock problem with a TTL; too short frustrates checkout, too long hides sellable inventory.

Click or drag a component onto the canvas, then connect the handles to draw the data flow.

3 nodes · 2 edges

Components · 35

Client & Edge4
Compute & Gateway7
Storage & Caching11
Messaging & Streaming6
Coordination & Ops5
Intelligence2
Canvas overview