Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Flight Booking System

A flight booking backend built with Spring Boot, Spring Data JPA, and MySQL — implemented first as a monolith (this repo) and then decomposed into four independent microservices to practice and demonstrate microservices architecture.

This repo is the entry point for the project: it holds the original monolithic implementation and links out to every microservice repo, so a reviewer can start here and drill into whichever piece they care about.

Demo

Watch the demo

Click to watch a walkthrough of the app: creating users, adding flights, and booking a flight end-to-end across services.

Repositories

Repo Description
flightbooking (this repo) Original monolith — all entities, services, and REST APIs in one Spring Boot app. Kept as a baseline/reference.
EntityService Shared library: JPA entities (User, Flight, Booking) and password hashing, consumed as a Maven dependency by the three services below.
UserService User CRUD REST API.
FlightService Flight CRUD REST API.
BookingService Booking CRUD REST API; calls UserService and FlightService to enrich each booking with user and flight details.

Why a monolith and microservices?

The monolith here was the first working version of the app. It was then split into EntityService + UserService + FlightService + BookingService to practice service decomposition, inter-service communication (REST via RestTemplate), a shared domain-model library, containerization, and Kubernetes deployment. Both versions are kept so the evolution is visible — this repo is the "before," the four service repos are the "after."

Architecture (microservices version)

flowchart LR
    Client[Client / Postman] --> US["UserService :8081"]
    Client --> FS["FlightService :8082"]
    Client --> BS["BookingService :8083"]
    BS -->|"GET /users/{id}"| US
    BS -->|"GET /flights/{id}"| FS
    US --> DB[(MySQL\nflight_booking)]
    FS --> DB
    BS --> DB
    ES["EntityService\n(shared JPA entities)"] -.Maven dependency.-> US
    ES -.Maven dependency.-> FS
    ES -.Maven dependency.-> BS
Loading

Tech stack

  • Java, Spring Boot, Spring Data JPA, Spring Security Crypto (BCrypt password hashing)
  • MySQL
  • Docker & Docker Compose
  • Kubernetes (Minikube) — deployment/service/PV/PVC manifests
  • Maven (multi-repo, with EntityService installed as a shared dependency)

Features

  • Full CRUD for users, flights, and bookings
  • Passwords hashed with BCrypt before persistence (see EntityService)
  • Booking creation enriches the response with live user and flight data fetched from the other services
  • Dockerized services with per-service Dockerfile and docker-compose.yml
  • Kubernetes manifests for deploying the full stack (MySQL + all three services) on Minikube

Running this repo (monolith)

# MySQL must be reachable at 127.0.0.1:3307 with db `flight_booking`
# (see starter-queries/queries.sql to create the admin user + database)
mvn spring-boot:run

The API is served under /api (e.g. http://localhost:8080/api/users).

Running the microservices version

See BookingService/docker-compose.yml — it brings up MySQL, UserService, FlightService, and BookingService together:

docker-compose up --build
Service Port
UserService 8081
FlightService 8082
BookingService 8083

For Kubernetes deployment steps, see UserService/kubernetes-commands.txt.

API overview

Resource Endpoints
Users GET /users, GET /users/{id}, POST /users, PUT /users, DELETE /users/{id}
Flights GET /flights, GET /flights/{id}, POST /flights, PUT /flights, DELETE /flights/{id}
Bookings GET /bookings, GET /bookings/{id}, POST /bookings, PUT /bookings, DELETE /bookings/{id}

In the monolith all three are under one app on port 8080; in the microservices version each is served by its own service (see table above), each still under the /api context path.

About

Spring Boot flight booking backend (monolith) — the original baseline before splitting into EntityService/UserService/FlightService/BookingService microservices.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages