Designing Database for a Flight Ticket Booking System in a Startup: A Tale of MVP and Scalability
Tags: mvp, database
Published: 2023-11-02 02:07:55

Embarking on a journey to design a flight ticket booking system for a startup can be both thrilling and daunting, especially when working on a Minimum Viable Product (MVP) project with just two weeks on the clock. However, the challenges of a tight deadline and the potential for future scalability can lead to exciting opportunities. In this article, we'll explore my experience in designing the initial database for a flight ticket booking system, focusing on a dynamic approach that allows for rapid growth while keeping the architecture manageable.

## **Use Case: Starting Small, Dreaming Big**

My project revolved around creating an MVP for booking flight tickets. While the initial scope was small, the potential for expansion and scalability was evident. To meet the demands of this dynamic environment, I had to make wise choices about the technology stack and architectural design.

## **Choosing the Right Tech Stack: Building for Today and Tomorrow**

I opted for a tech stack that would not only allow us to build the MVP quickly but also accommodate future growth seamlessly. The stack consisted of Java, Spring Boot, PostgreSQL, and a Monolithic architecture.

Here, I want to highlight the importance of choosing the right technology stack for your project. While microservices and more modern architectures are gaining popularity, the monolithic approach was a practical choice for our MVP. It provided us with a stable foundation to iterate upon, making it easier to manage the development process and ensure a faster time-to-market.

## **Database Design for Dynamic Scaling**

The heart of our flight ticket booking system lay in the database design. We aimed to create a structure that would enable us to start quickly and implement growth hacks while being flexible enough to scale with the evolving demands of the startup.

![Database Design for Dynamic Scaling](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5xk6mfw8e4lro7g0wadb.png)

**Here's an overview of the database design:**

1. **Flight**: This table stored information about flight objects, serving as the backbone of our system.
2. **Inventory**: All available tickets were stored in this table, including details about quantity and type, though without pricing information.
3. **Rate Master**: This table managed the different rates for tickets.
4. **Rate Detail**: It was closely linked to the Rate Master, containing items such as ticket price, taxes, and additional services (e.g., free bottled water).
5. **Rate Lookup**: This table served as a bridge between Rate Master and Inventory, enabling end-users to quickly access ticket prices.
6. **Reservation**: Here, we stored bookings made by end-users, including references to flight, inventory, and pricing.
7. **Customer**: Information about customers was stored in this table, making it easier to manage customer profiles.

## **Scalability Through Separation of Key Information**

The beauty of this database design lay in the separation of key information. Each domain, such as flights, inventory, prices, reservations, and customers, was stored independently, acting as the foundation for microservices and independent components. This separation not only allowed for ease of scaling but also simplified maintenance, making it possible to expand the system while preserving its efficiency.

With thinking and database model like this, I think we can apply it to other booking systems.

## **Conclusion**

Designing a flight ticket booking system for a startup, especially within a tight timeframe, can be challenging. However, by making informed choices regarding the technology stack and database design, you can create a foundation that not only serves your immediate needs but also paves the way for future growth and adaptability. The key is to strike a balance between building for today and planning for tomorrow, ensuring that your system can scale dynamically as your startup takes flight. This is my experience in the approach to building a system from scratch. I hope to receive contributions from everyone. Thank you for reading.