A backend web application for managing flight bookings, built with Java Spring Boot.
This is a flight booking system for a fictional airline called Timeout Airline. It allows customers to:
- Search for available flights
- Book flights online
- Earn rewards after multiple bookings
The system also helps the airline manage their planes, airports, flights, employees, and customers.
| Name | Role |
|---|---|
| Evelynval | User, Client, Employee, Booking, MilesReward |
| Hetvi | Plane, Airport, Flight, Flight Search |
- Java 21 - Programming language
- Spring Boot 4.0 - Backend framework
- MySQL - Database
- Maven - Dependency management
- JPA/Hibernate - Database ORM (auto-creates tables)
- Postman - API testing
src/main/java/fr/epita/timeoutairline/
βββ model/ β Database entities (User, Flight, Booking, etc.)
βββ repository/ β Database access layer
βββ service/ β Business logic
βββ controller/ β REST API endpoints
βββ dto/ β Data transfer objects
βββ exception/ β Custom error handling
The application automatically creates these tables:
| Table | Description |
|---|---|
users |
Base info for all people (name, email, phone, etc.) |
clients |
Customers who book flights (has passport number) |
employees |
Airline staff (pilots, attendants, etc.) |
planes |
Aircraft information (brand, model, year) |
airports |
Airport details (name, city, country) |
flights |
Flight schedules and pricing |
bookings |
Customer flight reservations |
miles_rewards |
Tracks bookings and discount codes |
- Java 21 installed
- MySQL installed and running
- An IDE (Eclipse or IntelliJ)
Open MySQL and run:
CREATE DATABASE timeout_airline;Open src/main/resources/application.properties and update:
spring.datasource.url=jdbc:mysql://localhost:3306/timeout_airline
spring.datasource.username=root
spring.datasource.password=YOUR_PASSWORDIn your IDE, run TimeoutairlineApplication.java
Or in terminal:
./mvnw spring-boot:runOpen Postman or your browser and go to:
http://localhost:8084/api/v1/planes
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/planes |
Get all planes |
| GET | /api/v1/planes/{id} |
Get one plane |
| POST | /api/v1/planes |
Create a plane |
| PUT | /api/v1/planes/{id} |
Update a plane |
| DELETE | /api/v1/planes/{id} |
Delete a plane |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/airports |
Get all airports |
| GET | /api/v1/airports/{id} |
Get one airport |
| GET | /api/v1/airports/city/{city} |
Get airports by city |
| POST | /api/v1/airports |
Create an airport |
| PUT | /api/v1/airports/{id} |
Update an airport |
| DELETE | /api/v1/airports/{id} |
Delete an airport |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/flights |
Get all flights |
| GET | /api/v1/flights/{flightNumber} |
Get one flight |
| GET | /api/v1/flights/search?from=X&to=Y&date=Z |
Search flights |
| POST | /api/v1/flights |
Create a flight |
| PUT | /api/v1/flights/{flightNumber} |
Update a flight |
| DELETE | /api/v1/flights/{flightNumber} |
Delete a flight |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/clients |
Get all clients |
| GET | /api/v1/clients/{id} |
Get one client |
| GET | /api/v1/clients/passport/{numPassport} |
Get client by passport |
| POST | /api/v1/clients |
Create a client |
| PUT | /api/v1/clients/{id} |
Update a client |
| DELETE | /api/v1/clients/{id} |
Delete a client |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/employees |
Get all employees |
| GET | /api/v1/employees/{id} |
Get one employee |
| POST | /api/v1/employees |
Create an employee |
| PUT | /api/v1/employees/{id} |
Update an employee |
| DELETE | /api/v1/employees/{id} |
Delete an employee |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/bookings |
Get all bookings |
| GET | /api/v1/bookings/{id} |
Get one booking |
| GET | /api/v1/bookings/available-seats/{flightNumber} |
Check available seats |
| POST | /api/v1/bookings |
Create a booking |
| POST | /api/v1/bookings/book |
Book a flight (new or existing customer) |
| DELETE | /api/v1/bookings/{id} |
Cancel a booking |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/miles-rewards |
Get all rewards |
POST /api/v1/planes
{
"brand": "Boeing",
"model": "737",
"manufacturingYear": 2020
}POST /api/v1/airports
{
"nameAirport": "Charles de Gaulle",
"countryAirport": "France",
"cityAirport": "Paris"
}POST /api/v1/flights
{
"flightNumber": "TA101",
"departureCity": "Paris",
"arrivalCity": "London",
"departureHour": "08:00",
"arrivalHour": "09:30",
"departureDate": "2025-01-15",
"numberOfSeat": 150,
"firstClassSeatPrice": 500.00,
"premiumSeatPrice": 300.00,
"businessClassPrice": 200.00,
"economicsClassPrice": 100.00,
"plane": {"idPlane": 1},
"departureAirport": {"idAirport": 1},
"arrivalAirport": {"idAirport": 2}
}POST /api/v1/bookings/book
{
"lastname": "Doe",
"firstname": "John",
"passportNumber": "AB123456",
"birthdate": "1990-05-15",
"departureCity": "Paris",
"arrivalCity": "London",
"flightNumber": "TA101",
"typeOfSeat": "BUSINESS"
}GET /api/v1/flights/search?from=Paris&to=London&date=2025-01-15
Customers can search for flights by:
- Departure city
- Arrival city
- Departure date
- Checks if seats are available before booking
- Creates new customer if they don't exist
- Uses existing customer if passport number is found
- Every booking is recorded
- After 3 flights in the same year, a discount code is automatically generated
- Example:
DISC-EDDB7CDE
- The system prevents overbooking
- You can check available seats anytime
- No overbooking - You cannot book a flight if all seats are taken
- Unique passport - Each client must have a unique passport number
- Unique employee number - Each employee must have a unique employee number
- Discount rewards - Discount code is generated every 3 flights per calendar year
The API returns helpful error messages:
Resource Not Found:
{
"status": 404,
"error": "Not Found",
"message": "Flight not found with flightNumber: 'TA999'"
}No Seats Available:
{
"status": 400,
"error": "Bad Request",
"message": "No available seats on flight TA101. Total: 150, Booked: 150"
}-
Start the application before the demo
-
Create data in this order:
- Planes first
- Airports second
- Flights third (they need planes and airports)
- Clients/Employees anytime
- Bookings last (they need flights and clients)
-
Show the discount code feature:
- Book 3 flights with the same client
- Check miles rewards to see the discount code
This project was created for EPITA's Java Application Development course by Okoene Makuo & Hetvi.
- EPITA School of Engineering
- Spring Boot Documentation
- Our Java Professor
Made with care by the Timeout Airline Team