The whole course ▾

System Design · Mock interview 18 of 20

Design a hotel booking system

Updated 22 Oct 2026 · By Akshay, software engineer, India · 9 min read

Design a hotel booking system, like Booking.com.

Try it first

Before you read the interview, answer the question yourself. Give yourself 10 minutes: say your design out loud, or sketch it on paper. What would you ask? Which numbers matter? Which boxes, and what's the hard part? Then read on, and score yourself with the feedback at the end.

The video for this mock interview is coming soon.

New System Design videos go up at 6 pm. Subscribe on YouTube so you don't miss it.

Got a doubt? Ask in the comments under the video.Subscribe

Requirements

Requirements
Clarifying questions
->
Scale? -> 1M hotels, 1M bookings a day
->
Exact rooms? -> No: room types
->
Sold elsewhere too? -> Yes, on many sites
->
Overbooking? -> A little, set by the hotel
Functional requirements
Search by place, dates and guests
See availability and price per stay
Hold, then book and pay
Cancel; hotels update rooms and prices
Non-functional requirements
->
Never sell more than allowed
->
Search in under 300 ms
->
Booking strictly correct
->
Search may lag by seconds
Out of scope
Reviews
Flights and car hire
Loyalty points
interviewer
Hi. Shall we start?
candidate
Sure. I'll draw as I go.
interviewer
Design a hotel booking system, like Booking.com. Travellers search for hotels in a city, for some dates, and book a room.
candidate
Okay. No big ten o'clock rush here, so I expect the hard parts are quieter. Let me ask about rooms, dates, and who else sells the same rooms.
interviewer
Go ahead.
candidate
What scale?
interviewer
About a million hotels, and a million bookings a day.
candidate
Do guests pick an exact room number?
interviewer
No. They book a room type, like deluxe double, and the hotel assigns the room at check-in.
candidate
Do hotels sell the same rooms elsewhere too?
interviewer
Yes, on several websites, and their own.
candidate
And is overbooking allowed?
interviewer
A little, as each hotel chooses, because some guests always cancel or don't turn up.
candidate
So, what it does. Search hotels by place, check-in and check-out dates, and number of guests. See availability, and the total price for the stay. Hold a room while paying, then book it. And cancel a booking, while hotels update their rooms and nightly prices whenever they like.
candidate
And how well. Never sell more rooms than allowed, counting the hotel's overbooking allowance. Search answers in under three hundred milliseconds, because travellers compare many hotels. Booking is strictly correct. And search results may lag the truth by a few seconds.
interviewer
Why is that okay?
candidate
As long as the booking step checks properly, a slightly stale search is fine.
candidate
I'll leave out reviews, flights and car hire, and loyalty points. Does that match what you had in mind?
interviewer
Yes. Show me how a stay gets booked correctly.

Estimation

Estimation
Back of the envelope
Bookings: 1M a day ~ 10 a second
~100 searches per booking ~ 1,000/s
1M hotels × 5 room types × 365 nights
~ 1.8B inventory rows, one per night
WHAT THE NUMBERS DECIDE
Searchesoutnumberbookings100
to1:searchfromafastindex,
bookagainstthetruth.Anda
stayismanynightsatonce.
candidate
Let me size it. I think a ratio will matter most.
interviewer
What load, and how much data?
candidate
Searches, bookings, and the inventory itself.
candidate
A million bookings a day is about ten a second. Gentle. But travellers look around a lot, maybe a hundred searches per booking, so about a thousand searches a second, and three thousand at peaks. And the inventory: a million hotels, about five room types each, for each of the next three hundred and sixty-five nights, is around one point eight billion rows, each a small counter.
interviewer
That sounds big.
candidate
At a few dozen bytes each, it's tens of gigabytes, spread across shards.
candidate
So, two things. Searches outnumber bookings a hundred to one, so search comes from a fast, slightly stale index, while bookings go to the source of truth. And inventory is counted per night, so a three-night stay isn't one counter, it's three, and they all have to be taken together.
interviewer
That second point is what I want to dig into.

API and data

API and data
Hotels
place, location, room
types
Room inventory
hotel, type, night ->
total, taken
Bookings
hotel, type, nights,
price, state
Rates
hotel, type, night ->
price
per night
takes nights
per night
Endpoints
1
GET
/search?place&checkin&checkout&guests
2
POST /holds -> a 15-minute hold
3
POST /bookings {hold, payment key}
4
DELETE /bookings/{id}: cancel
candidate
Next, the API, and an inventory built around nights.
interviewer
What does the API look like?
candidate
Search, hold, book, cancel.
candidate
GET slash search, with a place, check-in, check-out and guests, returning hotels with a total price, page by page. POST slash holds, for a hotel, a room type and the dates, which reserves the room for fifteen minutes and fixes the quoted price. POST slash bookings, with the hold and an idempotency key for the payment. And DELETE a booking to cancel it, which gives its nights back.
interviewer
Why fifteen minutes?
candidate
Long enough to type in card details. Short enough that an abandoned hold doesn't block a room for long.
candidate
Four tables. Hotels: where they are, and their room types. Room inventory: one row per hotel, room type and night, with how many rooms exist, and how many are taken or held. Bookings: which nights, which room type, the agreed price and the state. And rates: the price per night, which hotels change often. Everything is sharded by hotel.
interviewer
Why by hotel?
candidate
So one hotel's inventory, bookings and rates all live together. That'll matter in a minute.

High-level design

High-level design
Traveller's
app
Search
service
Search
index
location,
dates free,
prices
Goa, 3
nights
1
geo + dates + filters
2
Booking
service
Inventory
DB
sharded by
hotel
Kafka
inventory
changes
Payment
provider
hold deluxe,
3 nights
3
take 3 nights
4
pay, with
key
5
changed
update
summary
A booking's states
1
Held: nights reserved, 15 minutes
2
Confirmed: paid
3
Cancelled: nights given back
4
Expired: the hold ran out
TWO QUESTIONS
Howisamulti-nightstay
takenallatonce?Andhow
dosearch,overbookingand
othersitesstayhonest?
interviewer
Okay. Show me the design.
interviewer
Walk me through a search, then a booking.
candidate
Search first, since it carries most of the traffic.
candidate
The traveller's app searches: Goa, three nights, two guests. The search service asks a search index, which holds each hotel's location, its amenities, and a summary of which nights have rooms free, and at what price. It filters by area and dates, ranks the results, and returns twenty hotels with total prices. No booking database is touched while people browse.
interviewer
How does the index know the price for three nights?
candidate
It keeps a price per night, and adds up the nights at query time.
candidate
Booking takes the other path. The booking service places a hold on all three nights in the inventory DB, in one step. The traveller pays through the payment provider, with an idempotency key, and the hold becomes a booking. Every inventory change is published to Kafka, which updates the search index within seconds.
interviewer
So search is never fully live?
candidate
Nearly, within seconds, and it never touches the booking database.
candidate
A booking moves through simple states. Held: its nights reserved, for fifteen minutes. Confirmed, once paid. Cancelled, which gives its nights back. Or expired, if the traveller never paid, which also gives them back. So abandoned checkouts never block rooms.
interviewer
What gives the nights back on expiry?
candidate
The transaction already treats an expired hold as free, and a small sweeper tidies the counts every few seconds.
interviewer
Where can this go wrong?
candidate
Two places. Taking three nights at once, so a stay never ends up with two nights booked and the third sold to someone else. And keeping search, overbooking and the hotel's other websites honest with each other.
interviewer
The nights first.

Deep dive: all nights, or none

Deep dive: all nights, or none
Check every night, then book
Read three nights: all free
Then write three nights
Two readers both see free: a race
One transaction, conditional
Take each night only if one is left
All three succeed, or none do
One hotel, one shard: fast
THE CHOICE
Asingletransactionof
conditionalupdates,one
pernight;shardingbyhotel
keepsitononeshard.
High-level design
Traveller's
app
Search
service
Search
index
location,
dates free,
prices
Goa, 3
nights
1
geo + dates + filters
2
Booking
service
Inventory
DB
sharded by
hotel
Kafka
inventory
changes
Payment
provider
hold deluxe,
3 nights
3
take 3 nights
4
pay, with
key
5
changed
update
summary
3 rows or 0
the loser gets: just sold
out
A booking's states
1
Held: nights reserved, 15 minutes
2
Confirmed: paid
3
Cancelled: nights given back
4
Expired: the hold ran out
TWO QUESTIONS
Howisamulti-nightstay
takenallatonce?Andhow
dosearch,overbookingand
othersitesstayhonest?
interviewer
Let's look at the date range.
interviewer
Two travellers want the last deluxe room, for overlapping nights, at the same moment. How do you avoid double-booking?
candidate
Let me compare two approaches.
candidate
Checking every night first, then booking, is a classic race: two travellers both read three free nights, and both write. Instead, I'd use one database transaction: for each of the three nights, increase the taken count only where it's still below the allowed total. If all three rows change, commit. If any night was full, roll the whole thing back, and none are taken. All of the stay, or none of it.
candidate
And it's cheap here, because everything is sharded by hotel, so all three nights live on the same shard. No distributed transaction, no saga, just an ordinary local transaction.
interviewer
So the shard key was chosen for this.
candidate
Yes. Keeping the important transaction local is the point.
candidate
So the transaction changes three rows, or none. When two travellers race for overlapping nights, one commits; the other finds a full night, rolls back, and that loser sees: this room type just sold out for your dates, here are similar rooms. Only the overlapping nights ever conflict.
interviewer
The hotel raises its prices while a traveller is paying. Which price do they pay?
candidate
The one they were shown. The hold records the total price when it's placed, and the booking uses that, not the current rate. Price changes apply to new holds only. A quote that changes during checkout feels like a trick.
interviewer
Agreed.

Deep dive: honest availability

Deep dive: honest availability
Three honest answers
1
Search is a hint; booking is the truth
2
Overbooking: an allowance per room type
3
Other sites: synced through a channel manager
WHEN EVERYONE TURNS UP
Overbookingisabusiness
decisionwithaprocess:the
hotelmovestheguesttoa
similarhotel,atitscost.
interviewer
Now, honest availability.
interviewer
Search says one room left, the hotel overbooks on purpose, and three other websites sell the same rooms. How does this stay sane?
candidate
Three honest answers.
candidate
First, search is a hint, a few seconds behind; the booking transaction is the truth, and the app says so when a room has just gone. Second, overbooking is a small allowance per room type, set by the hotel from its own history of cancellations and no-shows. Third, other websites are kept in sync through a channel manager, a service that pushes each hotel's availability to every site, and receives their bookings.
interviewer
And on the night when every guest turns up?
candidate
Overbooking is a business decision, so it comes with a process: the hotel moves the guest to a comparable hotel nearby, at its own cost. The system's job is to keep overbooking within the hotel's limit, and to warn the hotel days ahead when a night is over-sold.
interviewer
Two websites sell the last room in the same second, before the channel manager syncs. What happens?
candidate
Each sale reaches the hotel's inventory as a booking request, and the transaction takes it only if allowed, including the allowance. If both fit, fine. If not, the second is rejected, and that site must cancel and apologise. Short sync gaps are exactly why hotels keep a small allowance.
interviewer
A conference books two hundred rooms for a week at one hotel. Any problem?
candidate
That's handled as a block: the hotel sets aside an allocation for the group, at agreed prices, outside the public inventory, and releases unused rooms back by a deadline. Same counters, with a separate pool.
interviewer
Good.

Wrap-up

Wrap-up
Next steps
1
Better ranking for each traveller
2
Prices that follow demand
3
Watch search-to-booking failures
4
Regions near travellers
INTERVIEWER'S FEEDBACK
Strong:per-nightinventory,an
all-or-nothingtransactionkeptlocal,search
asahint,overbookingbydesign.Nexttime:
cancellationsandrefunds.Verdict:hire.
interviewer
We're nearly at time.
interviewer
What would you improve with more time?
candidate
A few things.
candidate
First, better ranking of search results for each traveller, from what they booked before. Second, prices that follow demand, suggested to hotels from search and booking trends. Third, I'd watch how often a booking fails after search said the room was free, because that shows how stale search is. And fourth, regions near travellers, with each hotel's inventory in one home region.
interviewer
Which would you do first?
candidate
The watching. A failed booking after a happy search is what makes travellers leave.
interviewer
Okay, let's stop there. Good job. You modelled inventory per night, saw a stay as several counters at once, and kept the all-or-nothing transaction on one shard by sharding on the hotel. Search is honestly a hint, and overbooking is a rule with a process. One gap: cancellation rules and refunds, which travellers care about a lot. I'd say a hire.
candidate
Thanks. The refund rules would live with the rates, per booking.
Interviewer's feedback

Strong: per-night inventory, an all-or-nothing transaction kept local, search as a hint, overbooking by design. Next time: cancellations and refunds. Verdict: hire.

Score yourself

Interviewers score these seven things. Give your own attempt a tick for each one you did.

  • Asks before drawing. Agrees what the system does, and how well: scale, speed, consistency.
  • Turns users into requests a second and bytes a day, and says what the numbers decide.
  • A small, clear contract, and a data model that fits how the data is read.
  • A working path end to end before any detail. Every box has a reason.
  • Picks the hard parts, compares two options, and chooses one with a trade-off said out loud.
  • What breaks, what happens then, and how users notice. Retries, duplicates, limits.
  • Thinks out loud, checks in with the interviewer, and takes a hint without losing the thread.

0 of 7

Your progress stays on this device.
New System Design videos at 6 pm

Lessons on weekdays, the week's revision on Saturday, a mock interview on Sunday.