Skip to content

light Booking Service ✈️ is a high-performance backend microservice built to handle flight bookings reliably and efficiently. It ensures secure seat reservations, concurrency control, and seamless payment handling, even under heavy traffic. Part of a modular travel platform, it keeps your application stable, scalable, and production-ready.

Notifications You must be signed in to change notification settings

Bhupesh-aher/Flights-Booking-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight Booking Service ✈️ – Backend Microservice for Flight Booking Platform

🛠️ Backend | Node.js | Express.js | MySQL | Sequelize | JWT | Microservices


About

Flight Booking Service ✈️ is a high-performance backend microservice designed to handle flight booking operations reliably and efficiently. It is part of a modular flight booking platform, managing user bookings, seat allocations, and payments while ensuring data integrity and fault tolerance. Built with Node.js, Express, MySQL, and Sequelize, it’s optimized to handle concurrent booking requests and provide a robust, production-ready solution for modern travel platforms.


Architecture Overview

  • Microservices Architecture: Separates booking logic from flight search to handle high search traffic without affecting booking stability.
  • API Gateway / Reverse Proxy: Directs frontend requests to appropriate microservices.
  • Load Balancer: Distributes incoming traffic across service instances for high availability.
  • Service Communication: Booking Service may call Search Service to verify availability or update inventory.
  • Concurrency Handling: Implements row-level locking to prevent double-booking when multiple users try to book the same seat simultaneously.

High-Level Request Flow:

Frontend Request
      ↓
  Load Balancer
      ↓
  API Gateway
      ↓
Flight Booking Service ↔ Flight Search Service (if needed)

Features

  • Booking Management: Create, view, update, or cancel bookings.
  • Seat Allocation: Tracks seat availability and ensures atomic booking operations.
  • Concurrency Control: Row-level locking prevents double-booking during high load.
  • User Authentication: JWT-based authentication for secure access.
  • Payment Simulation: Handles fake payments to simulate seat reservation scenarios.
  • Service Resilience: Isolated microservice ensures system remains operational even if other services fail.

Functional Requirements

  • Users can create a booking with selected flights and seats.
  • Users can cancel or update their bookings.
  • The system validates seat availability before confirming bookings.
  • Payment flow (simulated) locks seats during transaction.
  • Service communicates with Search Service to fetch flight information if required.

Non-Functional Requirements

  • Scalability: Service can handle concurrent booking requests during peak periods.
  • Reliability: Microservice isolation ensures platform stability even under high search traffic.
  • Performance: Efficient DB queries and connection pooling reduce latency.
  • Security: JWT authentication secures endpoints; sensitive actions validated.
  • Maintainability: Modular codebase with Sequelize ORM and Express middlewares.

🛠️ Tech Stack

Backend:

  • Node.js – JavaScript runtime for server-side applications
  • Express.js – Framework for building RESTful APIs

Database & ORM:

  • MySQL – Relational database for bookings, users, and flights
  • Sequelize ORM – ORM for clean and maintainable DB operations

Authentication & Security:

  • JWT – Token-based authentication
  • Row-level locking & Transactions – Prevents double-booking and ensures consistency

Architecture & Patterns:

  • Microservices – Booking logic isolated from search for reliability
  • API Gateway / Reverse Proxy – Routes requests to the correct service
  • Concurrency & Atomic Operations – Guarantees booking integrity

Other Key Features:

  • RESTful APIs for booking operations
  • Seat locking mechanism during booking
  • Real-time booking simulation for high concurrency scenarios
  • Environment configuration with .env for DB, JWT secrets, and endpoints

API Endpoints (Example)

Endpoint Method Description
/bookings POST Create a new booking
/bookings/:id GET Retrieve booking details
/bookings/:id PUT Update existing booking
/bookings/:id DELETE Cancel a booking
/payment/simulate POST Simulate payment and seat lock

(Include sample request/response in future if needed for documentation)


Setup & Installation

  1. Clone the repository:
git clone https://github.com/Bhupesh-aher/Flights-Booking-Service.git
  1. Install dependencies:
cd Flights-Booking-Service
npm install
  1. Configure environment variables: Create a .env file and add:
DB_HOST=your_db_host
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=your_db_name
JWT_SECRET=your_jwt_secret
  1. Run database migrations with Sequelize:
npx sequelize-cli db:migrate
  1. Start the server:
npm run dev

Concurrency & Special Features

  • Implements row-level locking to prevent two users from booking the same seat simultaneously.
  • Ensures that one service crashing doesn’t affect the overall platform, thanks to microservice isolation.
  • Simulated payment system demonstrates how high-demand seat reservations are handled in real time.

Future Improvements

  • Integrate real payment gateways for live transactions
  • Add rate limiting & caching for search and booking APIs
  • Implement webhooks or message queues for async communication between services
  • Add logging and monitoring for production readiness

References

About

light Booking Service ✈️ is a high-performance backend microservice built to handle flight bookings reliably and efficiently. It ensures secure seat reservations, concurrency control, and seamless payment handling, even under heavy traffic. Part of a modular travel platform, it keeps your application stable, scalable, and production-ready.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published