# monesh-kumar-007/airline-reservation-system architecture

> Architecture diagram of the GitHub repository monesh-kumar-007/airline-reservation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/monesh-kumar-007/airline-reservation-system
- Repository: https://github.com/monesh-kumar-007/airline-reservation-system

## Overview

#### 1. Purpose and Runtime
Console-based airline reservation system implemented in Java with a layered/MVC-style separation. It manages users, flights, and bookings against a local Oracle XE database through JDBC. The operational entry point is `backend-java/src/AirlineReservationApp.java`; database connectivity can be independently checked with `backend-java/src/TestOracle.java`.

#### 2. Presentation and Control Entry
The application starts its interactive console loop in `backend-java/src/AirlineReservationApp.java`, delegating user-facing navigation to UI classes. Authentication and initial choices are handled by `backend-java/src/ui/MainMenu.java`; authenticated customer actions are exposed through `backend-java/src/ui/UserDashboard.java`. UI should remain the boundary for console input/output and delegate state changes to services.

#### 3. Business-Service Layer
`backend-java/src/service/AuthService.java` owns registration/login-oriented workflows and mediates user persistence. `backend-java/src/service/ReservationSystem.java` is the core reservation domain service: it coordinates flight discovery, booking creation/management, seat availability changes, and transactional database work. This layer is the principal boundary between console workflows and JDBC persistence.

#### 4. Domain Model
Persistent business records are represented by Java model objects:
- `backend-java/src/model/User.java`
- `backend-java/src/model/Flight.java`
- `backend-java/src/model/Bookings.java`

They map conceptually to Oracle `USERS`, `FLIGHTS`, and `BOOKINGS` tables. Booking records link a user and flight, include passenger/seat/status information, and therefore form the central relationship in reservation flows.

#### 5. Persistence, Transactions, and Security Boundary
`backend-java/src/util/DBUtil.java` provides Oracle JDBC connectivity using the Oracle thin driver. The runtime relies on `backend-java/lib/ojdbc11.jar`, connecting to local Oracle XE/XEPDB1 on port 1521. Database password input is externalized through the `DB_PASSWORD` environment variable rather than source code. Service-layer mutations are expected to use prepared statements and transaction-safe seat allocation logic.

The schema and relational constraints are established by `database/Airline Database.session.sql`; foreign keys from bookings to users and flights enforce the core persistence boundary.

#### 6. Supporting Domain Controls
`backend-java/src/util/InputValidator.java` centralizes validation for interactive input, including credential-format checks, before service/database operations. `backend-java/src/util/IDGenerator.java` supports application-side identifiers where required. These utilities support, but should not replace, database constraints or service-level transactional checks.

#### 7. Primary Flows
1. Launch: `AirlineReservationApp` initializes the console UI and routes users through `MainMenu`.
2. Identity: UI submits login or registration input to `AuthService`, which validates and persists/queries `User` data via Oracle.
3. Reservation: `UserDashboard` invokes `ReservationSystem` to retrieve flights, create or manage bookings, and update seat inventory atomically.
4. Persistence: services acquire JDBC connections through `DBUtil`, execute prepared SQL against the Oracle schema, then return domain results to the UI.

Main entry points: [`backend-java/src/util/DBUtil.java`](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/DBUtil.java) (DBUtil), [`backend-java/src/service/ReservationSystem.java`](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/service/ReservationSystem.java) (ReservationSystem), [`backend-java/src/ui/MainMenu.java`](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/ui/MainMenu.java) (MainMenu), [`backend-java/src/model/Bookings.java`](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/Bookings.java) (Bookings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Console UI"]
  node_app{{"AirlineReservationApp<br/>Java entry point"}}
  node_main_menu["MainMenu<br/>console navigation<br/>[MainMenu.java]"]
  node_dashboard["UserDashboard<br/>console dashboard<br/>[UserDashboard.java]"]
  node_input_validator["InputValidator<br/>input validation"]
end

subgraph group_services["Business Services"]
  node_auth_service["AuthService<br/>authentication service<br/>[AuthService.java]"]
  node_reservation_service["ReservationSystem<br/>reservation service"]
  node_id_generator["IDGenerator<br/>identifier utility<br/>[IDGenerator.java]"]
  node_user["User<br/>domain model<br/>[User.java]"]
  node_flight["Flight<br/>domain model<br/>[Flight.java]"]
  node_booking["Bookings<br/>domain model<br/>[Bookings.java]"]
end

subgraph group_persistence["Oracle Persistence"]
  node_db_util["DBUtil<br/>JDBC connection utility<br/>[DBUtil.java]"]
  node_oracle_driver["ojdbc11.jar<br/>Oracle JDBC driver<br/>[ojdbc11.jar]"]
  node_db_password["DB_PASSWORD<br/>environment secret"]
  node_oracle_db[("Oracle XE / XEPDB1<br/>relational database")]
  node_schema["Airline schema<br/>SQL schema"]
  node_test_oracle["TestOracle<br/>connectivity check<br/>[TestOracle.java]"]
end

node_app -->|"launches"| node_main_menu
node_main_menu -->|"routes authenticated users"| node_dashboard
node_main_menu -->|"validates input"| node_input_validator
node_main_menu -->|"login / registration"| node_auth_service
node_dashboard -->|"validates input"| node_input_validator
node_dashboard -->|"reservation actions"| node_reservation_service
node_auth_service -->|"uses"| node_user
node_reservation_service -->|"retrieves and updates"| node_flight
node_reservation_service -->|"creates and manages"| node_booking
node_reservation_service -.->|"generates IDs"| node_id_generator
node_auth_service -->|"JDBC persistence"| node_db_util
node_reservation_service -->|"transactional JDBC work"| node_db_util
node_db_util -->|"uses"| node_oracle_driver
node_db_util -.->|"reads"| node_db_password
node_db_util -->|"connects to"| node_oracle_db
node_test_oracle -->|"checks connectivity"| node_db_util
node_schema -->|"establishes tables and constraints"| node_oracle_db
node_user -.->|"maps to USERS"| node_schema
node_flight -.->|"maps to FLIGHTS"| node_schema
node_booking -.->|"maps to BOOKINGS"| node_schema
node_booking -->|"belongs to"| node_user
node_booking -->|"reserves"| node_flight

click node_app "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/AirlineReservationApp.java"
click node_main_menu "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/ui/MainMenu.java"
click node_dashboard "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/ui/UserDashboard.java"
click node_input_validator "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/InputValidator.java"
click node_auth_service "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/service/AuthService.java"
click node_reservation_service "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/service/ReservationSystem.java"
click node_id_generator "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/IDGenerator.java"
click node_user "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/User.java"
click node_flight "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/Flight.java"
click node_booking "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/Bookings.java"
click node_db_util "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/DBUtil.java"
click node_oracle_driver "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/lib/ojdbc11.jar"
click node_schema "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/database/Airline%20Database.session.sql"
click node_test_oracle "https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/TestOracle.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_main_menu,node_dashboard,node_input_validator toneBlue
class node_auth_service,node_reservation_service,node_id_generator,node_user,node_flight,node_booking toneAmber
class node_db_util,node_oracle_driver,node_db_password,node_oracle_db,node_schema,node_test_oracle toneMint
```

## Components

### Console UI

Interactive input/output and navigation.

- [AirlineReservationApp](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/AirlineReservationApp.java): Java entry point · Starts the interactive console application. · `backend-java/src/AirlineReservationApp.java`
- [MainMenu](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/ui/MainMenu.java): console navigation · Handles authentication and initial choices. · `backend-java/src/ui/MainMenu.java`
- [UserDashboard](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/ui/UserDashboard.java): console dashboard · Exposes authenticated customer actions. · `backend-java/src/ui/UserDashboard.java`
- [InputValidator](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/InputValidator.java): input validation · Validates interactive and credential input. · `backend-java/src/util/InputValidator.java`

### Business Services

Workflow and transaction boundary.

- [AuthService](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/service/AuthService.java): authentication service · Owns registration and login workflows. · `backend-java/src/service/AuthService.java`
- [ReservationSystem](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/service/ReservationSystem.java): reservation service · Coordinates flight search, bookings, seats, and transactions. · `backend-java/src/service/ReservationSystem.java`
- [IDGenerator](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/IDGenerator.java): identifier utility · Generates application-side identifiers where needed. · `backend-java/src/util/IDGenerator.java`
- [User](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/User.java): domain model · `backend-java/src/model/User.java`
- [Flight](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/Flight.java): domain model · `backend-java/src/model/Flight.java`
- [Bookings](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/model/Bookings.java): domain model · Links users, flights, passengers, seats, and status. · `backend-java/src/model/Bookings.java`

### Oracle Persistence

JDBC connectivity and relational storage.

- [DBUtil](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/util/DBUtil.java): JDBC connection utility · Provides Oracle thin-driver connections. · `backend-java/src/util/DBUtil.java`
- [ojdbc11.jar](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/lib/ojdbc11.jar): Oracle JDBC driver · `backend-java/lib/ojdbc11.jar`
- **DB_PASSWORD**: environment secret · Supplies the database password outside source code.
- **Oracle XE / XEPDB1**: relational database · Local Oracle database on port 1521.
- [Airline schema](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/database/Airline%20Database.session.sql): SQL schema · Defines USERS, FLIGHTS, BOOKINGS, and foreign keys. · `database/Airline Database.session.sql`
- [TestOracle](https://github.com/monesh-kumar-007/airline-reservation-system/blob/main/backend-java/src/TestOracle.java): connectivity check · Independently verifies Oracle database connectivity. · `backend-java/src/TestOracle.java`

## Connections

- AirlineReservationApp → MainMenu: launches
- MainMenu → UserDashboard: routes authenticated users
- MainMenu → InputValidator: validates input
- MainMenu → AuthService: login / registration
- UserDashboard → InputValidator: validates input
- UserDashboard → ReservationSystem: reservation actions
- AuthService → User: uses
- ReservationSystem → Flight: retrieves and updates
- ReservationSystem → Bookings: creates and manages
- ReservationSystem → IDGenerator: generates IDs
- AuthService → DBUtil: JDBC persistence
- ReservationSystem → DBUtil: transactional JDBC work
- DBUtil → ojdbc11.jar: uses
- DBUtil → DB_PASSWORD: reads
- DBUtil → Oracle XE / XEPDB1: connects to
- TestOracle → DBUtil: checks connectivity
- Airline schema → Oracle XE / XEPDB1: establishes tables and constraints
- User → Airline schema: maps to USERS
- Flight → Airline schema: maps to FLIGHTS
- Bookings → Airline schema: maps to BOOKINGS
- Bookings → User: belongs to
- Bookings → Flight: reserves
