All system design challenges
#65 Supplier Aggregation/Microservices

Expedia (Online Travel Platform)

Build one site where travellers search, compare and book flights, hotels and cars sold by hundreds of outside suppliers.

Asked at Expedia Booking.com MakeMyTrip

What is being asked

Design an online travel platform like Expedia. The platform owns very little inventory itself: flights, hotels and cars come from airlines, hotel chains and wholesalers through their own APIs. The interviewer wants to see how you split the product into services and how you live with slow, unreliable suppliers.

Requirements

Functional

  • Search flights, hotels and cars; filter, sort and compare.
  • Book a single item or a package (flight + hotel), pay once.
  • View, change and cancel trips; receive confirmations.

Non-functional

  • Search results in about 2 seconds even when suppliers are slow.
  • Bookings must never be lost or double-charged.
  • Millions of searches a day, with a look-to-book ratio of roughly 1,000 : 1.

Design

Web / appAPI gatewaySearch serviceBooking serviceTrip serviceFare + rate cacheSupplier adaptersPayment serviceAirlines / hotels /GDS
Boxes are services; rounded shapes are data stores and queues.
  1. Supplier adapters hide every supplier's API behind one internal model ("offer", "booking", "cancellation"). Adding a supplier means writing one adapter, nothing else.
  2. Search fans out to the relevant suppliers in parallel with a hard timeout, merges and ranks what came back, and caches the results.
  3. Booking re-checks the price with the supplier, holds the item, takes payment and confirms, as a saga with a compensating step for each stage.
  4. Trip service stores the confirmed itinerary that the traveller sees and changes later.

Key decisions and trade-offs

  • Cache aggressively for search, never for booking. Because so few searches turn into bookings, search can show cached prices that are minutes old; the price is always re-checked at booking time.
  • Partial results over slow results. If one supplier misses the timeout, show the others. Each adapter gets a circuit breaker so one dead supplier doesn't slow every search.
  • Packages are sagas. If the hotel confirms but the flight fails, cancel the hotel. There is no distributed transaction across airlines.
  • Idempotency keys on every booking call, because supplier timeouts are common and retries must not double-book.

Follow-up questions

  • The price changes between search and booking. What does the user see?
  • How do you sell a flight + hotel package cheaper than the two items separately?
  • How would you add a new supplier without redeploying search?
  • What do you do when a supplier confirms a booking but your system crashes before saving it?
Log in to tick off the challenges you have worked through. Log in