# tanvir-pg/bus-ticketing-system architecture

> Architecture diagram of the GitHub repository tanvir-pg/bus-ticketing-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanvir-pg/bus-ticketing-system
- Repository: https://github.com/tanvir-pg/bus-ticketing-system

## Overview

This is a Java Swing bus-ticket booking application backed by MySQL/MariaDB. Users sign in or register, browse scheduled trips, select a seat, make or cancel a reservation, and view or export ticket receipts; administrators manage booking and transport data. The map separates screens, booking and authentication services, administrative data access, and persistence/domain models. README content was empty, so capability coverage relies on the source index and sampled code; edges are limited to relationships visible in those sources.

Main entry points: [`BusTicketManagementSystem/src/database/DBConnection.java`](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/database/DBConnection.java) (JDBC connection), [`BusTicketManagementSystem/src/gui/LoginFrame.java`](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/LoginFrame.java) (Login screen), [`BusTicketManagementSystem/src/gui/AdminDashboard.java`](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/AdminDashboard.java) (Admin dashboard), [`BusTicketManagementSystem/src/service/BookingService.java`](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/service/BookingService.java) (Booking service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_main["Application entry<br/>[Main.java]"]
  node_login["Login screen<br/>[LoginFrame.java]"]
  node_registration["Registration screen<br/>[RegisterFrame.java]"]
  node_customer["Customer dashboard"]
  node_seatselect["Seat selection"]
  node_history["Booking history"]
  node_ticket["Ticket display<br/>[TicketFrame.java]"]
  node_admin["Admin dashboard"]
  node_uiutils["UI utilities<br/>[UIUtils.java]"]
end

subgraph group_services["Application services"]
  node_auth["Authentication<br/>[AuthService.java]"]
  node_bookingservice["Booking service"]
end

subgraph group_data["Data access"]
  node_bookingdao["Booking access<br/>[BookingDAO.java]"]
  node_route["Route access<br/>[RouteDAO.java]"]
  node_trip["Trip access<br/>[TripDAO.java]"]
  node_bus["Bus access<br/>[BusDAO.java]"]
  node_seat["Seat access<br/>[SeatDAO.java]"]
  node_userdao["User access<br/>[UserDAO.java]"]
  node_dbconn["JDBC connection<br/>[DBConnection.java]"]
end

subgraph group_domain["Persistence and domain"]
  node_bookingmodel["Booking model<br/>[Booking.java]"]
  node_tripmodel["Trip model<br/>[Trip.java]"]
  node_routemodel["Route model<br/>[Route.java]"]
  node_busmodel["Bus model<br/>[Bus.java]"]
  node_seatmodel["Seat model<br/>[Seat.java]"]
  node_usermodel["User model<br/>[User.java]"]
end

node_user(("User"))
node_mysql[("MySQL / MariaDB")]

node_user -->|"launches"| node_main
node_main -->|"opens"| node_login
node_login -->|"authenticates"| node_auth
node_login -->|"opens"| node_registration
node_login -->|"routes admin"| node_admin
node_login -->|"routes customer"| node_customer
node_registration -->|"registers"| node_auth
node_customer -->|"loads trips"| node_trip
node_customer -->|"loads routes"| node_route
node_customer -->|"opens"| node_seatselect
node_customer -->|"opens"| node_history
node_seatselect -->|"reserves seat"| node_bookingservice
node_seatselect -->|"opens"| node_ticket
node_history -->|"uses"| node_bookingservice
node_history -->|"loads bookings"| node_bookingdao
node_history -->|"opens"| node_ticket
node_ticket -->|"exports receipt"| node_bookingservice
node_admin -->|"manages bookings"| node_bookingdao
node_admin -->|"manages buses"| node_bus
node_admin -->|"manages routes"| node_route
node_admin -->|"manages trips"| node_trip
node_admin -->|"manages users"| node_userdao
node_login -->|"styles with"| node_uiutils
node_auth -->|"authenticates via"| node_userdao
node_bookingservice -->|"books and cancels"| node_bookingdao
node_bookingservice -->|"loads availability"| node_seat
node_bookingservice -->|"checks trip"| node_trip
node_bookingdao -->|"opens connection"| node_dbconn
node_route -->|"opens connection"| node_dbconn
node_trip -->|"opens connection"| node_dbconn
node_bus -->|"opens connection"| node_dbconn
node_seat -->|"opens connection"| node_dbconn
node_userdao -->|"opens connection"| node_dbconn
node_dbconn -->|"connects"| node_mysql
node_bookingdao -->|"maps records"| node_bookingmodel
node_route -->|"maps records"| node_routemodel
node_trip -->|"maps records"| node_tripmodel
node_bus -->|"maps records"| node_busmodel
node_seat -->|"maps records"| node_seatmodel
node_userdao -->|"maps records"| node_usermodel
node_auth -->|"creates session user"| node_usermodel

click node_main "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/Main.java"
click node_login "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/LoginFrame.java"
click node_registration "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/RegisterFrame.java"
click node_customer "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/CustomerDashboard.java"
click node_seatselect "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/SeatSelectionFrame.java"
click node_history "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/BookingHistoryFrame.java"
click node_ticket "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/TicketFrame.java"
click node_admin "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/AdminDashboard.java"
click node_uiutils "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/UIUtils.java"
click node_auth "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/service/AuthService.java"
click node_bookingservice "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/service/BookingService.java"
click node_bookingdao "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/BookingDAO.java"
click node_route "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/RouteDAO.java"
click node_trip "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/TripDAO.java"
click node_bus "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/BusDAO.java"
click node_seat "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/SeatDAO.java"
click node_userdao "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/UserDAO.java"
click node_dbconn "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/database/DBConnection.java"
click node_bookingmodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Booking.java"
click node_tripmodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Trip.java"
click node_routemodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Route.java"
click node_busmodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Bus.java"
click node_seatmodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Seat.java"
click node_usermodel "https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/User.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_main,node_login,node_registration,node_customer,node_seatselect,node_history,node_ticket,node_admin,node_uiutils,node_user toneBlue
class node_auth,node_bookingservice,node_mysql toneAmber
class node_bookingdao,node_route,node_trip,node_bus,node_seat,node_userdao,node_dbconn toneMint
class node_bookingmodel,node_tripmodel,node_routemodel,node_busmodel,node_seatmodel,node_usermodel toneRose
```

## Components

### Desktop interface

- [Application entry](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/Main.java): `BusTicketManagementSystem/src/Main.java`
- [Login screen](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/LoginFrame.java): `BusTicketManagementSystem/src/gui/LoginFrame.java`
- [Registration screen](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/RegisterFrame.java): `BusTicketManagementSystem/src/gui/RegisterFrame.java`
- [Customer dashboard](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/CustomerDashboard.java): `BusTicketManagementSystem/src/gui/CustomerDashboard.java`
- [Seat selection](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/SeatSelectionFrame.java): `BusTicketManagementSystem/src/gui/SeatSelectionFrame.java`
- [Booking history](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/BookingHistoryFrame.java): `BusTicketManagementSystem/src/gui/BookingHistoryFrame.java`
- [Ticket display](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/TicketFrame.java): `BusTicketManagementSystem/src/gui/TicketFrame.java`
- [Admin dashboard](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/AdminDashboard.java): `BusTicketManagementSystem/src/gui/AdminDashboard.java`
- [UI utilities](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/gui/UIUtils.java): `BusTicketManagementSystem/src/gui/UIUtils.java`

### Application services

- [Authentication](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/service/AuthService.java): `BusTicketManagementSystem/src/service/AuthService.java`
- [Booking service](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/service/BookingService.java): `BusTicketManagementSystem/src/service/BookingService.java`

### Data access

- [Booking access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/BookingDAO.java): `BusTicketManagementSystem/src/dao/BookingDAO.java`
- [Route access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/RouteDAO.java): `BusTicketManagementSystem/src/dao/RouteDAO.java`
- [Trip access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/TripDAO.java): `BusTicketManagementSystem/src/dao/TripDAO.java`
- [Bus access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/BusDAO.java): `BusTicketManagementSystem/src/dao/BusDAO.java`
- [Seat access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/SeatDAO.java): `BusTicketManagementSystem/src/dao/SeatDAO.java`
- [User access](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/dao/UserDAO.java): `BusTicketManagementSystem/src/dao/UserDAO.java`
- [JDBC connection](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/database/DBConnection.java): `BusTicketManagementSystem/src/database/DBConnection.java`

### Persistence and domain

- [Booking model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Booking.java): `BusTicketManagementSystem/src/model/Booking.java`
- [Trip model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Trip.java): `BusTicketManagementSystem/src/model/Trip.java`
- [Route model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Route.java): `BusTicketManagementSystem/src/model/Route.java`
- [Bus model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Bus.java): `BusTicketManagementSystem/src/model/Bus.java`
- [Seat model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/Seat.java): `BusTicketManagementSystem/src/model/Seat.java`
- [User model](https://github.com/tanvir-pg/bus-ticketing-system/blob/main/BusTicketManagementSystem/src/model/User.java): `BusTicketManagementSystem/src/model/User.java`

### Other components

- **User**
- **MySQL / MariaDB**

## Connections

- User → Application entry: launches
- Application entry → Login screen: opens (evidence: `BusTicketManagementSystem/src/Main.java`)
- Login screen → Authentication: authenticates (evidence: `BusTicketManagementSystem/src/gui/LoginFrame.java`)
- Login screen → Registration screen: opens (evidence: `BusTicketManagementSystem/src/gui/LoginFrame.java`)
- Login screen → Admin dashboard: routes admin (evidence: `BusTicketManagementSystem/src/gui/LoginFrame.java`)
- Login screen → Customer dashboard: routes customer (evidence: `BusTicketManagementSystem/src/gui/LoginFrame.java`)
- Registration screen → Authentication: registers (evidence: `BusTicketManagementSystem/src/gui/RegisterFrame.java`)
- Customer dashboard → Trip access: loads trips (evidence: `BusTicketManagementSystem/src/gui/CustomerDashboard.java`)
- Customer dashboard → Route access: loads routes (evidence: `BusTicketManagementSystem/src/gui/CustomerDashboard.java`)
- Customer dashboard → Seat selection: opens (evidence: `BusTicketManagementSystem/src/gui/CustomerDashboard.java`)
- Customer dashboard → Booking history: opens (evidence: `BusTicketManagementSystem/src/gui/CustomerDashboard.java`)
- Seat selection → Booking service: reserves seat (evidence: `BusTicketManagementSystem/src/gui/SeatSelectionFrame.java`)
- Seat selection → Ticket display: opens (evidence: `BusTicketManagementSystem/src/gui/SeatSelectionFrame.java`)
- Booking history → Booking service: uses (evidence: `BusTicketManagementSystem/src/gui/BookingHistoryFrame.java`)
- Booking history → Booking access: loads bookings (evidence: `BusTicketManagementSystem/src/gui/BookingHistoryFrame.java`)
- Booking history → Ticket display: opens (evidence: `BusTicketManagementSystem/src/gui/BookingHistoryFrame.java`)
- Ticket display → Booking service: exports receipt (evidence: `BusTicketManagementSystem/src/gui/TicketFrame.java`)
- Admin dashboard → Booking access: manages bookings (evidence: `BusTicketManagementSystem/src/gui/AdminDashboard.java`)
- Admin dashboard → Bus access: manages buses (evidence: `BusTicketManagementSystem/src/gui/AdminDashboard.java`)
- Admin dashboard → Route access: manages routes (evidence: `BusTicketManagementSystem/src/gui/AdminDashboard.java`)
- Admin dashboard → Trip access: manages trips (evidence: `BusTicketManagementSystem/src/gui/AdminDashboard.java`)
- Admin dashboard → User access: manages users (evidence: `BusTicketManagementSystem/src/gui/AdminDashboard.java`)
- Login screen → UI utilities: styles with (evidence: `BusTicketManagementSystem/src/gui/LoginFrame.java`)
- Authentication → User access: authenticates via (evidence: `BusTicketManagementSystem/src/service/AuthService.java`)
- Booking service → Booking access: books and cancels (evidence: `BusTicketManagementSystem/src/service/BookingService.java`)
- Booking service → Seat access: loads availability (evidence: `BusTicketManagementSystem/src/service/BookingService.java`)
- Booking service → Trip access: checks trip (evidence: `BusTicketManagementSystem/src/service/BookingService.java`)
- Booking access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/BookingDAO.java`)
- Route access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/RouteDAO.java`)
- Trip access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/TripDAO.java`)
- Bus access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/BusDAO.java`)
- Seat access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/SeatDAO.java`)
- User access → JDBC connection: opens connection (evidence: `BusTicketManagementSystem/src/dao/UserDAO.java`)
- JDBC connection → MySQL / MariaDB: connects (evidence: `BusTicketManagementSystem/src/database/DBConnection.java`)
- Booking access → Booking model: maps records (evidence: `BusTicketManagementSystem/src/dao/BookingDAO.java`)
- Route access → Route model: maps records (evidence: `BusTicketManagementSystem/src/dao/RouteDAO.java`)
- Trip access → Trip model: maps records (evidence: `BusTicketManagementSystem/src/dao/TripDAO.java`)
- Bus access → Bus model: maps records (evidence: `BusTicketManagementSystem/src/dao/BusDAO.java`)
- Seat access → Seat model: maps records (evidence: `BusTicketManagementSystem/src/dao/SeatDAO.java`)
- User access → User model: maps records (evidence: `BusTicketManagementSystem/src/dao/UserDAO.java`)
- Authentication → User model: creates session user (evidence: `BusTicketManagementSystem/src/service/AuthService.java`)
