System Design of a hotel reservation system — Part 2
In Part 1, we described the system and the data model for the hotel side of the marketplace. If you haven’t read that already, I would highly recommend you do. The link to Part 1 is here.
System Design of a hotel reservation system — Part 1
System Design of a hotel reservation system — Part 3
Coming to the customer side of the marketplace, the primary functional requirements which we also described in Part 1, are as follows:
- Search for hotels in a city/geo-location
- See details of the hotel (room types, charges, availability)
- Create a reservation
- Cancel a reservation
Let’s start with the first requirement i.e. the customers must be able to search for a hotel based on a city or geo-location. To enable this, we can use a search engine like Elasticsearch. With elasticsearch, we can make fuzzy queries. Additionally, we can also train a NLP model or use the default model to enable semantic search. We can also run geo_distance queries with elasticsearch. The data will flow into elasticsearch from the “hotels” topic described in Part 1. We can have a lambda (serverless function) that consumes messages from “hotels” topic and adds/updates records in elasticsearch index. Adding elasticsearch to our component diagram, it now looks like this:

The elasticsearch index will store the hotel details as a composite object document, something like:
{
"name": "ABC",
"address": "DEF",
.
.
.
"contact": [
{
"type": "PHONE",
"value": "9876543210"
}
],
"images": [
"ImageURL1",
"ImageURL2"
],
"tags": [
"5 star",
"near airport",
"hygienic"
]
}
Now that we have our data ready to be searched, we need a service that exposes the search endpoint. So let’s now get into the client for the customers.
Customers can access the platform either via website or mobile app. We can have a service called hotel-search-service which internally queries the elasticsearch index based on the customer input.
With the new customer-search-service, our component diagram now looks like this:

The customer can enter his/her choice of city and this system in its current state will return a list of hotels with all the required details and image URLs. The clients can then make a call to CDN to download the images to be shown to the customers.
At this point, we have a system that serves as a hotel directory. We will build further on top of this to get a fully working reservation system ready, in the next post. Thanks for reading!