TSTier SlateAll templates
  1. Home
  2. Templates
  3. Hotel booking

Marketplaces & booking

Hotel booking - selling a range, on purpose, slightly twice

Why a stay is sold night by night or not at all, and why selling the last room twice is sometimes deliberate.

  • System design
  • core
  • 8 step walkthrough
  • 5 tables
Own this board 400 creditsPractise as an interview

The first act plays here. Owned once with credits, never a subscription.

Share

  • Facebook
  • X

What this board gets wrong on purpose

The tension

Overbooking is a priced business decision and the board draws it as a component, which is the honest version - but the percentage is computed from historical no-show rates, and the third party pushing the most inventory changes into this system is a channel manager whose availability view is seconds to minutes behind ours. So the overbooking margin is stacked on top of a synchronisation lag of unknown size, and the two failure modes are indistinguishable from the outside: a night that oversells because the policy said 103% and a night that oversells because Expedia sold a room we had already sold both end with a guest in the lobby at 23:00. Nothing on this board can tell the operator which one happened. The cancellation window is the second unresolved edge: free_cancel_until is stored in the property timezone and evaluated by a worker running in UTC, so every daylight-saving boundary is an hour in which the system charges people it should not and refunds people it should.

Practise this as an interview

Take Hotel booking - selling a range, on purpose, slightly twice as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

Practise this as an interview

Start here

Why this design

Hotel booking is the reservation problem with a twist: the unit of sale is a room-night but the unit of purchase is a stay, so every booking is a range that must be sold entirely or not at all. Interviewers use it to probe concurrency control (how you stop two guests getting the last room on Saturday), read-heavy search over a write-contended table, and whether you recognise that some "double selling" is deliberate. Booking.com, Expedia and every hotel chain's own engine are built around this exact table.

What you will learn

  • Why a stay is exploded into one inventory row per night, so the database can lock Saturday - and why an overlap query on (check_in, check_out) is where double-booking lives.
  • Why the booking write is one transaction across every night in the range: all the nights or none.
  • Why selling about 103% of the hotel is a priced decision against a 4-8% no-show rate, drawn as a component, and what walking a guest costs.
  • Why the biggest writer to inventory is not your guests: 347 channel-manager writes/s against 2.3 bookings/s, a 150:1 ratio.
  • Why search is 14,500 row reads per row written, and why the inventory table is a rolling 170 GB that never grows.
  • Why the cancellation deadline is stored on the reservation, not computed from today's policy.

How to read this board

  1. Press play once: the walkthrough follows one three-night stay from search to a cancellation.
  2. SHOP: search over a range of nights, not a row.
  3. DATA, then BOOK: per-night inventory and the all-or-nothing write.
  4. THE OTHER WRITER: the channel managers that push more writes than your own customers.
  5. CANCEL: the window is the product.
  6. DATA MODEL: the range exploded into rows so it can be locked.
  7. Then pages 1 to 6 in order: requirements, capacity, storage, availability, how it works, deployment.

1 · Requirements

The unit of sale is a room-night. The unit of purchase is a stay. Almost everything difficult here comes from that mismatch.

Ask these before designing

  • Are we the hotel or the agency? If we own the inventory we are the source of truth. If we are an OTA, we hold a cached copy of somebody else’s truth and every guarantee weakens accordingly. This board assumes we own it and also sell through agencies, which is the hardest of the three.
  • Is overbooking allowed, and who owns the number? It is a revenue-management decision with a cost line for walking guests. If the answer is "no", occupancy drops by 4-8% and somebody will ask why.
  • Do we hold inventory during checkout? For a 2-minute booking flow, a hold is often not worth the complexity; for a flow with an approval step, it is essential.
  • Whose timezone is the cancellation deadline in? The property’s, always - but the worker that enforces it runs in UTC, and that gap is a real bug twice a year.
  • Rate plans: how many, and do they restrict? Minimum stay, closed-to-arrival and non-refundable are not pricing, they are availability, and they belong in the search path.
  • What is the booking horizon? 500 days sets the size of the inventory table exactly.

Functional

  • Search availability for a date range, a party size and a set of filters.
  • Book a stay: all nights or none.
  • Apply rate-plan restrictions (min-stay, closed-to-arrival) at search time, not at booking time.
  • Modify or cancel, applying the property’s cancellation policy and charging the penalty.
  • Accept inventory and rate updates from channel managers, and push our availability back to them.
  • Support a deliberate overbooking margin per property, per season.

Non-functional

  • Search p95 under 400 ms across 50 properties x 20 room types x 3 nights - 3,000 inventory rows per query, which is why search reads a precomputed model and never the transactional table.
  • Booking is strongly consistent. All nights commit together or the booking fails.
  • Search availability 99.99%, degrading to a stale read model rather than an error.
  • Booking availability 99.95%, failing closed.
  • Channel updates applied within 60 s at p99. Beyond that, the agency is selling rooms against a view we know is wrong.

Explicitly out of scope

Dynamic pricing and revenue management models, loyalty programmes, housekeeping and room assignment, property onboarding, payments compliance.

The rest of this board

Preview of the Hotel booking system design board: 15 components joined by 17 connections. The labelled board opens in Tierslate.
Board preview

Available on Tier Slate

This page publishes the question. The answer — 5 more written pages, an 8-step narrated walkthrough and a 5-table schema — is the board itself, and it opens in Tierslate.

  • 5written pages
  • 8walkthrough steps
  • 5tables34 columns

5 pages behind this one

  • Capacity estimation
  • Storage estimation
  • Availability
  • How it works
  • Deployment plan
Open this board in TierslateBrowse every board

Related system design templates

Two-sided systems where inventory must not be sold twice. 7 more marketplaces & booking templates:

  • Checkout system design - Why stock is held before the card is charged, and what must unwind when the charge fails.
  • Auction bidding system design - Why bids are ordered by a sequence under one lock rather than a clock, and how soft close moves the end.
  • Food delivery system design - How three parties who can each say no move one order through a shared state machine to a promised ETA.
  • Seat sales system design - Why fifty thousand buyers for one hundred seats is a contention problem that sharding cannot solve.
  • Coupon codes system design - Why a single-use code is a race between every checkout holding it, and how a conditional write settles it.
  • Rental search system design - How a stay search filters by place, dates and price at once, and why the availability calendar is the bottleneck.
  • Job board system design - How listings are indexed for search and applications are routed, and why expired jobs must disappear fast.
Open the Hotel booking board in TierslateAll marketplaces & booking templatesAll 100 system design templates
Tierslate

tierslate.com

HomeTemplatesGuidesCompareAboutUI mockupsPrivacyTerms