A fully interactive, real-world flight reservation system built using pure Python (no frameworks) and JSON file storage. Supports global + Indian capital routes, automatic daily flight generation, bold terminal UI, two-way search, ticket booking, PNR generation, and booking management.
- Search flights both directions (A → B & B → A)
- Auto-generated flights daily
- Domestic + international capital cities
- Real-time future travel dates
- Departure, arrival & duration calculation
- Book up to 3 passengers per ticket
- Passenger details stored (name, age, gender)
- Auto-generated unique PNR number
- Persistent storage using JSON
- Seat availability updates after booking
- View all bookings anytime
- Cancel bookings & restore seats
- Bold, clean terminal output — no emojis
- Pure Python data structures — beginner-friendly
| Component | Technology |
|---|---|
| Language | Python 3.x |
| Storage | JSON files |
| Data | Lists & Dictionaries |
| UI | Command-Line Interface |
Flight Ticket Booking System/
│
├── app.py
├── flights.json
└── bookings.json
app.py→ main application logicflights.json→ live flight databookings.json→ confirmed ticket records
- Clone the repository:
git clone https://github.com/SahirC22/flight-ticket-booking-system.git
cd flight-ticket-booking-system- Run the program:
./app.py(Use python3 if required)
1. Search Flights
2. Book Ticket
3. View Bookings
4. Cancel Booking
5. Exit
Enter source city: Delhi
Enter destination city: Mumbai
- Shows available flights
- Sorted cheapest first
- Both directions included
Example output:
Available flights between Delhi and Mumbai (both ways):
ID: 12 | Vistara | 2025-11-27 09:45 → 14:20 | Seats: 18 | Price: ₹6200 | Duration: 4h 35m
Enter flight ID to book: 12
How many passengers? (1-3): 2
Result:
Booking Confirmed! Booking ID: 7 | PNR: X8PQ9K
{
"booking_id": 7,
"pnr": "X8PQ9K",
"flight_id": 12,
"airline": "Vistara",
"date": "2025-11-27",
"passengers": [
{ "name": "Amit", "age": "24", "gender": "M" },
{ "name": "Riya", "age": "22", "gender": "F" }
],
"total_seats": 2,
"total_price": 12400
}- All Indian state/UT capitals
- Major world capitals — London, Tokyo, Washington DC, Paris, Dubai, etc.
- Random flight generation between any two capitals
- File handling & JSON storage
- CLI program structuring
- Searching & sorting logic
- Random data generation
- ANSI bold formatting
- Data persistence in Python
- Realistic booking logic
- Python beginners
- College mini-project
- Portfolio showcase
- Offline flight booking simulation
- Learning CRUD operations without databases
Pull requests are welcome — feel free to improve UI, add features, or optimize logic!
Free to use, modify & learn from — educational & personal projects welcome
Abdus Sahir Choudhury
Assam down town University
B.Tech CSE | Python | GenAI Developer