System design interview: design a home rental marketplace like Airbnb

A home rental marketplace lets hosts list places with a nightly calendar and lets guests search by map and dates, then book. The interview is mostly about two things: a search that combines location, dates and filters without scanning every listing, and a booking path that never gives the same night to two guests even when they click at the same moment.

By Published 8 min read

1. Clarify the requirements

The walk-through describes a generic rental marketplace of this kind, not Airbnb's actual systems. Ask which side of the marketplace the interviewer cares about; most want the guest's search and booking flow.

  • Functional: hosts create listings with photos, rules, a nightly price and a calendar; guests search by place, dates and number of guests, filter by price and amenities, view a listing, book and pay; both sides leave reviews after the stay.
  • Non-functional: search responds in a few hundred milliseconds; booking is strongly consistent for the dates involved; listing pages and photos load fast worldwide; availability shown in search may lag by seconds.
  • Out of scope unless asked: messaging between host and guest, dynamic pricing suggestions, identity verification, experiences and long-term rentals.

2. Estimate the scale

Assumed round numbers, not any company's real figures.

Back-of-envelope estimate for a large rental marketplace (assumed figures)
QuantityAssumptionResult
Active listings10 millionfits comfortably in one search cluster, split into shards
Searches300 million a dayabout 3,500 a second on average; plan for 10,000 at peak
Bookings1 million a dayabout 12 a second; small, but each must be correct
Calendar rows10 million listings x 365 nights aheadabout 3.65 billion rows, roughly 110 GB at 30 bytes each
Photos20 photos per listing, several sizes eachthe largest storage item, served from object storage through a CDN
Back-of-envelope estimate for a large rental marketplace (assumed figures). Scroll sideways on a small screen.

The ratio is the story: roughly 300 searches per booking. Optimize search for throughput and accept staleness; optimize booking for correctness and accept that it is a little slower.

3. Define the API

GET  /v1/search?bbox=lat1,lng1,lat2,lng2&checkIn=2027-03-03&checkOut=2027-03-06&guests=2&maxPrice=180&page=1
     -> 200 { results: [{ listingId, title, photo, lat, lng, totalPrice, rating }], nextPage }
GET  /v1/listings/{id}?checkIn=...&checkOut=...   -> 200 { details, priceBreakdown, available }
POST /v1/bookings/hold   { listingId, checkIn, checkOut, guests, idempotencyKey } -> 201 { bookingId, holdExpiresAt, total }
POST /v1/bookings/{id}/confirm  { paymentMethodId } -> 200 { status: "confirmed" }
PUT  /v1/listings/{id}/calendar  { nights: [{ date, status, price }] }   (host side)
Search is a read against the index; booking is a two-step hold and confirm.

4. Sketch the data model

Source-of-truth tables in a relational database, sharded by listing
TableKeyFields
listinglisting_idhost, title, location (lat, lng), capacity, amenities, base price, currency, house rules
availability(listing_id, night)status (open, held, booked, blocked), booking_id, held_until, price override
bookingbooking_idlisting, guest, check-in, check-out, total, status, payment reference
reviewreview_idbooking, author, subject, rating, text, published_at
Source-of-truth tables in a relational database, sharded by listing. Scroll sideways on a small screen.

Sharding by listing_id keeps a listing, its calendar and its bookings on one shard, so the booking transaction never spans machines. Guest-facing queries such as "my trips" go to a secondary table keyed by guest, filled asynchronously.

5. Search by map, dates and filters

A relational query that joins listings to 3.65 billion calendar rows for every map drag would be far too slow. Build a search index instead, fed by change events from the listing and availability tables.

  • Geo first. Index each listing's coordinates with a geo index (a geohash or quadtree cell, or the geo point type of a search engine such as Elasticsearch or OpenSearch). A bounding-box query returns candidate listings in the visible map area.
  • Dates second. Store availability in the index as a compact structure per listing, for example a bitmap of open nights for the next year. Checking a three-night stay becomes a bitwise test, not a join.
  • Filters and price. Guests, amenities and nightly price are ordinary indexed fields. Total price for the dates needs per-night overrides, so compute it for the top results only, not for every candidate.
  • Rank. Order by a relevance score that mixes distance from the map center, rating, price fit and conversion history. Ranking models are their own topic; one sentence is enough unless asked.

The index lags the database by a few seconds. That is acceptable because the booking step re-checks the real calendar. Typeahead for place names ("Lisb...") is a separate small service, the same shape as search autocomplete.

6. Hold and confirm without double booking

Two guests can request overlapping dates in the same second. With one row per night, a single conditional update claims every night in the range only if all of them are free. If fewer rows change than the number of nights, someone else got there first, and the transaction rolls back.

BEGIN;
UPDATE availability
   SET status = 'held', booking_id = :booking, held_until = :now_plus_15min
 WHERE listing_id = :listing
   AND night >= :check_in AND night < :check_out
   AND (status = 'open' OR (status = 'held' AND held_until < :now));
-- application: if rows_changed != nights_requested then ROLLBACK else COMMIT
Claim nights [check-in, check-out) in one statement; commit only if every night was claimed. Tested in SQLite.
  • Check-out night is excluded (night < :check_out), so a stay ending on the 6th and one starting on the 6th do not collide.
  • Expired holds are reclaimable in the same statement, so no cleanup job has to run before dates become bookable again. A background sweep still resets old holds for tidiness and for the search index.
  • Confirm re-checks ownership. Before charging, the confirm step verifies that every night still carries this booking_id; an expired hold that lost a night to another guest fails cleanly instead of charging for a partial stay.
  • Concurrency. In PostgreSQL at the default isolation level, a second update waits for the first one's row locks and then re-checks its WHERE clause, so it sees the nights as held. Say which database you assume and how it behaves.

The ticket booking walk-through covers the hold pattern under a flash crowd, with a waiting room. Rentals rarely see that rush, so here the per-listing row locks are enough.

7. The architecture

  1. Clients
    • Guest app and web
    • Host app and web
  2. Edge
    • CDN for photos
    • API gateway
  3. Services
    • Search
    • Listing and calendar
    • Booking
    • Payments and payouts
    • Reviews
  4. Data
    • Sharded relational DB
    • Search index (geo + availability)
    • Object storage
  5. Async
    • Change-event queue and indexer
    • Notifications
    • Payout scheduler
Search, booking and payment paths for a rental marketplace. Guests and hosts use web and mobile apps through an API gateway. Search requests go to a search service that queries a geo-aware search index. Listing and calendar edits go to a listing service backed by a sharded relational database; change events flow through a queue to an indexer that updates the search index. Booking requests go to a booking service that holds nights in the same database, then calls a payment service, which talks to a payment provider. A payout scheduler pays hosts after check-in. Photos live in object storage behind a CDN, and a notification service sends emails and push messages.

Payments follow the usual rules: an idempotency key on every charge, a ledger, and reconciliation with the provider. The payment system walk-through covers those. What is specific here is timing: the guest pays at booking, while the host's payout is scheduled for after check-in, so a cancellation before arrival refunds the guest without clawing money back from the host.

8. What breaks, and what you do about it

Failure modes worth naming
FailureEffectMitigation
Search shows a listing that was just bookedGuest clicks, then sees "not available"Accept it and re-check on the listing page; keep indexing lag low with change events instead of nightly rebuilds
Payment provider times out after a holdDates locked but outcome unknownRetry with the same idempotency key; the hold expiry frees the nights if the booking never confirms
Host also lists on another site and gets booked thereReal double booking across platformsCalendar sync imports and exports; block synced nights quickly; a cancellation policy for the rare conflict
Popular city on a holiday weekendSearch spike on a few geo cellsCache search results per cell, dates and filters for a short time; scale the search tier horizontally
Shard with a very large hostOne shard gets most writesShard by listing, not host, so a host with thousands of listings is spread out
Failure modes worth naming. Scroll sideways on a small screen.

9. Trade-offs to discuss

  • Per-night rows or date ranges. Ranges (a booking from the 3rd to the 6th) use fewer rows but need interval overlap checks or exclusion constraints. Per-night rows cost more storage and make the check trivial.
  • Hold length. A long hold protects a slow payer but blocks other guests; a short one causes failures at payment. Around 10 to 15 minutes is a common choice for a design like this.
  • Instant book or host approval. Approval adds a pending state that holds dates for hours, which changes the hold logic and the search index.
  • Price in the index or computed later. Indexing a nightly price enables price filters; exact totals with fees, taxes and discounts are computed for the shortlist only.
  • Search freshness. Pushing every calendar change into the index costs write load; batching it adds staleness. A few seconds is a reasonable middle.

10. How to talk through it in the interview

Fictional example

Handling the double-booking follow-up
Interviewer
Two people book the same cabin for overlapping weekends at the same time. What happens?
Candidate
Both requests reach the booking service, which runs one conditional update on the cabin's night rows in a transaction. The first one changes all three rows and commits. The second waits on the row locks, then finds one night already held, changes only two rows, sees the count is short and rolls back. That guest gets a clear "dates just taken" message.
Interviewer
And the search results they saw?
Candidate
The index catches up within seconds from the change event. Until then, the listing page and the booking step both read the real calendar, so stale search costs a click, not a wrong booking.
  • Draw search and booking as two separate paths with different stores, and explain the ratio that justifies it.
  • Write the conditional update on the board; it is short and shows you know the mechanics.
  • Mention payouts after check-in; it shows you see a two-sided marketplace, not a shop.

Running a mock of this design with Natively

Ask a friend to play the interviewer on a call and to interrupt with the double-booking and stale-search questions. Natively, open on your Mac or Windows PC, keeps a transcript of the conversation and can propose talking points for whatever was just asked, which helps you notice when an answer skipped hold expiry or payout timing. It can also sketch the search and booking paths as a diagram if you ask, so you can compare it with your own board. Go through the saved notes the next day and practice only the parts you fumbled.

Questions people ask

How do you prevent double booking in an Airbnb system design?

Store one availability row per listing per night and claim the whole stay with one conditional update inside a transaction: set the nights to held only where they are open or their hold has expired. If fewer rows change than the number of nights, roll back and tell the guest the dates were just taken.

How does Airbnb-style search combine location and dates?

A search index holds each listing's coordinates in a geo index plus a compact record of open nights, such as a bitmap for the coming year. A map query finds listings in the visible area, the date check is a fast bitwise test, and exact prices are computed only for the top results.

Should search results be strongly consistent with bookings?

No. Searches outnumber bookings by a wide margin, so the index is updated from change events and may lag by a few seconds. The listing page and the booking step read the real calendar, so a stale result costs the guest a click, never a wrong booking.

When does a host get paid in a rental marketplace design?

A common design charges the guest at booking and schedules the host's payout for shortly after check-in. That keeps refunds simple when a guest cancels before arrival, since no money has left the platform yet. Each charge and payout uses an idempotency key and is reconciled with the payment provider.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP