Assume you are asked to design a hotel search and booking service that runs inside a larger platform (similar to an online travel agency).
Requirements:
-
Hotel and room data are provided by external hotel systems via their APIs. Your system must import hotel and room information, and keep it reasonably up to date.
-
Users search for hotels near a location specified by latitude/longitude, along with check-in/check-out dates and number of guests.
-
The system must show available rooms and prices, and allow a user to place a booking.
-
The true source of availability is the external hotel systems. Those systems are also accepting bookings from other channels at the same time, so room availability can change at any moment.
Design the system and focus on:
-
The high-level architecture, including services that handle import/sync, search, and booking, and how they interact with external hotel APIs.
-
The database schema for hotels, rooms, availability/pricing, and bookings.
-
The end-to-end flows for: (a) importing hotel/room data, (b) searching for hotels, and (c) creating a booking and receiving confirmation.
-
How your design maintains consistency of room availability with the external hotel systems, and how it handles concurrency (e.g., multiple users or servers trying to book the last room) and external API failures.