Skip to content

RevantPatel/Bus-Booking-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleeper Bus Ticket Booking System

(Ahmedabad <-> Mumbai)

Overview

A web-based sleeper bus booking system with integrated meal selection and a mock AI-based booking confirmation prediction feature.

The system demonstrates real-world backend concepts such as concurrency handling, transaction safety, and probabilistic prediction logic.


Key Features

  • Interactive seat selection (Upper & Lower deck)
  • Meal booking during checkout (Full / Half meal)
  • Concurrency-safe seat booking (prevents double booking)
  • Booking cancellation with seat release
  • Mock prediction API for booking confirmation probability

Core APIs

  • GET /seat – List all seats with availability
  • POST /booking/preview – Calculate price before confirmation
  • POST /booking/confirm – Confirm booking
  • POST /booking/cancel – Cancel booking and release seats
  • POST /booking/predict – Predict booking confirmation probability

Test Scenarios

Functional

  • Successful booking with seat and meal
  • Seat availability reflected in real time
  • Booking cancellation releases seats

Edge Cases

  • Two users attempting to book the same seat concurrently
  • Booking attempt without selecting any seat

Tech Stack

  • Backend: Python (FastAPI)
  • Database: SQLite
  • Frontend: React + Vite

Setup Instructions

Backend

  1. Navigate to server folder.
  2. Install dependencies: pip install -r requirements.txt
  3. Run the server: uvicorn app.main:app --reload
  4. API runs at: http://localhost:8000
  5. Docs available at: http://localhost:8000/docs

Frontend

  1. Navigate to client folder.
  2. Install dependencies: npm install
  3. Run the app: npm run dev

About

High-concurrency booking engine using Python (FastAPI) & MySQL with Row-Level Locking to prevent race conditions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors