Build a hotel booking platform that lets travelers search for accommodations, reserve rooms, and manage their stays. The system must track real-time inventory across thousands of properties, apply dynamic nightly pricing that varies by date and demand, and handle concurrent booking attempts during peak travel periods without overselling. Users search by destination and dates, browse room options with accurate pricing, complete reservations with payment, and manage their bookings through modifications or cancellations.
The central technical challenge is maintaining data integrity when inventory is scarce. When the last available room receives simultaneous booking requests, the system must guarantee that exactly one succeeds. You need to model nightly room availability at scale, compute total stay costs from per-night rates plus taxes and fees, and orchestrate multi-step booking workflows that span payment processing, inventory updates, and confirmation delivery. Your design should separate read-heavy search workloads from write-heavy reservation transactions so each can scale independently.
Based on real interview experiences, these are the areas interviewers probe most deeply:
The heart of the design is how you track room availability. Interviewers want to see per-night, per-room-type modeling rather than a simple boolean at the hotel level, because multi-night stays can span dates with partial availability.
Hints to consider:
When multiple users attempt to book the last room simultaneously, your system must prevent overselling while maintaining throughput. Interviewers expect a discussion of locking strategies and transactional semantics.
Hints to consider:
Search traffic vastly exceeds booking volume. Interviewers look for a clear separation between the transactional database and the search infrastructure.
Hints to consider:
Hotels apply complex pricing rules including seasonal rates, occupancy surcharges, jurisdiction-specific taxes, and promotional discounts. Interviewers want to see structured thinking about where this logic lives.
Hints to consider:
A reservation spans multiple steps: inventory hold, payment authorization, confirmation creation, and potentially rollback on payment failure. Interviewers probe how you maintain consistency across these steps.
Hints to consider:
Confirm whether the system covers a single hotel chain or a marketplace aggregating thousands of properties. Ask if real-time pricing updates from hotels are required or if overnight batch updates suffice. Verify expected search and booking volumes, geographic distribution, and whether you are integrating with legacy property management systems. Clarify functional boundaries: are you responsible for payment processing or calling an external gateway? Do cancellations refund automatically or require approval?
Sketch a service-oriented architecture. 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 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 Kafka to decouple inventory updates from search reindexing.
Walk through the core booking transaction. 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. If every night has at least one available room, it decrements available_count for each date, inserts a reservation row 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. On payment failure or timeout, it rolls back, returning inventory to the pool. Explain how row-level locks prevent concurrent transactions from seeing stale availability, and how composite indexing ensures the range scan completes in milliseconds.
For scalability, partition the inventory table by date and use read replicas for search queries that tolerate slight lag. For reliability, implement idempotency tokens so retries never double-book or double-charge, and use circuit breakers around payment gateway calls. For latency, cache popular searches in Redis with short TTLs and precompute minimum prices per hotel. For consistency, publish inventory changes to Kafka and have a consumer update Elasticsearch, accepting eventual consistency in search while guaranteeing strong consistency on the booking path. Discuss observability: track booking success rates, lock wait times, cache hit rates, and search latency percentiles. Briefly touch on disaster recovery with cross-AZ database replication and Kafka topic mirroring.