Build a hotel booking platform that enables travelers to discover accommodations, reserve rooms, and manage their stays. Your system must handle the complexities of real-time inventory tracking across thousands of properties, dynamic pricing that varies by date and demand, and concurrent booking attempts during high-traffic periods like holiday weekends. Users will search by destination and travel dates, browse room options with accurate pricing, complete reservations with payment, and manage their bookings through modifications or cancellations.
The technical challenge lies in maintaining data integrity when inventory is scarce -- preventing double-bookings while serving search results with sub-second latency. You need to model nightly room availability at scale, compute total stay costs from per-night rates and fees, and orchestrate multi-step booking flows that span payment processing, inventory updates, and confirmation delivery. Think through how your design handles race conditions when the last available room receives simultaneous booking attempts, and how you separate read-heavy search workloads from write-heavy reservation transactions.
Based on real interview experiences, these are the areas interviewers probe most deeply:
The heart of your design is how you track room availability at a granular level. Interviewers want to see you model inventory per night, per room type, rather than treating availability as a simple boolean at the hotel level. A multi-night stay spanning dates with partial availability must be handled correctly.
Hints to consider:
inventory table with rows for each (hotel, room_type, date, available_count) tuple to track nightly availabilityWhen multiple users attempt to book the last available room simultaneously, your system must prevent overselling. Interviewers expect you to discuss transactional semantics, locking strategies, and how to maintain throughput under contention.
Hints to consider:
Search traffic vastly exceeds booking volume, and users expect fast results with complex filters. Interviewers look for separation of concerns between your transactional database and search infrastructure.
Hints to consider:
When many reservations arrive simultaneously -- for instance during a flash sale or holiday opening -- write throughput to your inventory tables becomes a bottleneck. Interviewers probe how you handle hot partitions where a popular hotel or date range concentrates writes on the same rows.
Hints to consider:
A booking is not atomic -- it involves inventory hold, payment authorization, reservation creation, confirmation delivery, and potentially rollback if payment fails. Interviewers want to see how you maintain consistency across these steps and recover gracefully from partial failures.
Hints to consider:
Start by confirming scope and scale with your interviewer. Ask whether the system covers a single hotel chain or a marketplace aggregating thousands of properties. Clarify if you need to support real-time pricing updates from hotels, or if overnight batch updates suffice. Confirm expected search and booking volumes, geographic distribution, and whether you are designing for a greenfield system or integrating with legacy property management systems. Verify functional boundaries: are you responsible for payment processing, or calling an external gateway? Do cancellations refund automatically, or require manual approval?
Sketch a service-oriented architecture with clear separation of concerns. A Search Service backed by Elasticsearch handles queries with filters, returning hotel metadata and availability flags. A Booking Service owns the transactional workflow, interacting with a relational database (PostgreSQL) to check precise inventory and create reservations. A Pricing Service computes total costs from base rates, taxes, and fees. A Payment Service wraps interactions with payment gateways. An Inventory Service updates nightly availability counts and publishes events to refresh the search index asynchronously. Place Redis in front of hot paths for caching search results and holding soft-locks during checkout. Use a message queue (Kafka or SQS) to decouple inventory updates from search reindexing, ensuring eventual consistency without blocking booking transactions.
Walk through the core booking transaction in detail. When a user selects dates and a room type, the Booking Service starts a database transaction. It queries the inventory table for all dates in the range using SELECT FOR UPDATE to acquire row-level locks. If every night has at least one room available, it decrements available_count for each date and inserts a row into the reservations table with a generated confirmation code and PENDING status. The service then calls the Payment Service with an idempotency key. On payment success, it updates the reservation to CONFIRMED and commits the transaction. If payment fails or times out, it rolls back, returning inventory to the pool. Discuss how FOR UPDATE row locks prevent concurrent transactions from seeing stale availability, and how indexing on (hotel_id, room_type_id, date) ensures the range scan completes in milliseconds even with millions of inventory rows.
Cover remaining non-functional requirements. For scalability, partition the inventory table by date (monthly or quarterly partitions) to keep active queries performant and archive old data. Use read replicas for search-related queries that tolerate slight lag. For reliability, implement idempotency tokens on booking requests so retries do not double-charge or double-book. Use circuit breakers around payment gateway calls to fail fast and release inventory locks. For fault tolerance, explain how a failed database write should not leave orphaned assets -- if writing the reservation row fails, ensure that any thumbnails already uploaded to blob storage are cleaned up by a garbage collection job that reconciles blob storage against confirmed reservations. For latency, explain how caching popular searches in Redis with 5-minute TTLs reduces database load, and how precomputing min/max prices per hotel avoids aggregation queries. For consistency, describe how inventory changes publish events to Kafka; a consumer updates Elasticsearch, accepting eventual consistency in search results while guaranteeing strong consistency in the booking path.