Design the backend for a host (landlord) listings page.
User flow:
-
Host opens a page showing
many of their listings
.
-
Host selects a
date range
.
-
For each listing shown, the UI displays aggregated metrics for that range, e.g.:
-
Nights booked
(how many nights are reserved within the range)
-
Average price
within the range
Assume you start with these tables:
-
Listings(listing_id, host_id, ... )
-
Reservations(reservation_id, listing_id, start_date, end_date, status, ... )
-
Pricing(listing_id, date, price, currency, ... )
Problem:
-
When a host has
100+ listings
, the page becomes slow.
Task:
-
Propose an end-to-end design (APIs, data access patterns, storage/indexing, caching/precomputation) to make the page fast and scalable.
-
Specify how you would compute the metrics correctly (including edge cases like partial overlap, cancellations) and keep them up to date.
-
Include performance goals and how you would validate them.