# abishagj/metro-rail-reservation-system architecture

> Architecture diagram of the GitHub repository abishagj/metro-rail-reservation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abishagj/metro-rail-reservation-system
- Repository: https://github.com/abishagj/metro-rail-reservation-system

## Overview

This is a single-file, full-stack metro ticket booking app: passengers look up their account, choose stations, find upcoming trains, book a ticket, then receive it by SMS or PDF. Express serves both the React interface and REST API; MySQL provides booking and schedule data. The README describes additional booking and database behavior, but the SQL schema file it names is absent from the supplied tree. Some internal service calls fall in omitted app.js excerpts, so those links are left unverified.

Main entry points: [`app.js`](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js) (React booking UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Passenger interface"]
  node_react_ui["React booking UI<br/>[app.js]"]
end

subgraph group_api["REST API"]
  node_account_lookup["Account lookup<br/>[app.js]"]
  node_station_search["Station search<br/>[app.js]"]
  node_train_search["Upcoming trains<br/>[app.js]"]
  node_booking_api["Booking endpoint<br/>[app.js]"]
  node_pdf_endpoint["PDF download route<br/>[app.js]"]
end

subgraph group_booking["Ticket services"]
  node_booking_procedure["Booking procedure<br/>[app.js]"]
  node_ticket_pdf["PDF generation<br/>[app.js]"]
  node_sms_delivery["SMS delivery<br/>[app.js]"]
end

subgraph group_data["Data layer"]
  node_mysql[("MySQL database")]
end

node_passenger(("Passenger"))
node_sms_provider["SMS provider"]

node_passenger -->|"uses"| node_react_ui
node_react_ui -->|"looks up"| node_account_lookup
node_react_ui -.->|"searches"| node_station_search
node_react_ui -.->|"requests trains"| node_train_search
node_react_ui -->|"submits booking"| node_booking_api
node_react_ui -->|"downloads ticket"| node_pdf_endpoint
node_account_lookup -->|"queries"| node_mysql
node_station_search -->|"queries"| node_mysql
node_train_search -->|"queries"| node_mysql
node_booking_api -->|"calls procedure"| node_mysql
node_booking_api -->|"invokes"| node_booking_procedure
node_booking_api -.->|"dispatches SMS"| node_sms_delivery
node_pdf_endpoint -.->|"generates ticket"| node_ticket_pdf
node_ticket_pdf -.->|"reads booking"| node_mysql
node_sms_delivery -.->|"sends message"| node_sms_provider

click node_react_ui "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_account_lookup "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_station_search "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_train_search "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_booking_api "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_pdf_endpoint "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_booking_procedure "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_ticket_pdf "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"
click node_sms_delivery "https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js"

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_react_ui toneBlue
class node_account_lookup,node_station_search,node_train_search,node_booking_api,node_pdf_endpoint toneAmber
class node_booking_procedure,node_ticket_pdf,node_sms_delivery toneMint
class node_mysql toneRose
class node_passenger,node_sms_provider toneIndigo
```

## Components

### Passenger interface

- [React booking UI](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`

### REST API

- [Account lookup](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [Station search](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [Upcoming trains](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [Booking endpoint](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [PDF download route](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`

### Ticket services

- [Booking procedure](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [PDF generation](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`
- [SMS delivery](https://github.com/abishagj/metro-rail-reservation-system/blob/main/app.js): `app.js`

### Data layer

- **MySQL database**

### Other components

- **Passenger**
- **SMS provider**

## Connections

- Passenger → React booking UI: uses (evidence: `README.md`)
- React booking UI → Account lookup: looks up (evidence: `app.js`)
- React booking UI → Station search: searches (evidence: `app.js`)
- React booking UI → Upcoming trains: requests trains (evidence: `app.js`)
- React booking UI → Booking endpoint: submits booking (evidence: `app.js`)
- React booking UI → PDF download route: downloads ticket (evidence: `app.js`)
- Account lookup → MySQL database: queries (evidence: `app.js`)
- Station search → MySQL database: queries (evidence: `app.js`)
- Upcoming trains → MySQL database: queries (evidence: `app.js`)
- Booking endpoint → MySQL database: calls procedure (evidence: `app.js`)
- Booking endpoint → Booking procedure: invokes (evidence: `app.js`)
- Booking endpoint → SMS delivery: dispatches SMS (evidence: `app.js`)
- PDF download route → PDF generation: generates ticket (evidence: `app.js`)
- PDF generation → MySQL database: reads booking
- SMS delivery → SMS provider: sends message
