# hsn-hashim/railway-project architecture

> Architecture diagram of the GitHub repository hsn-hashim/railway-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hsn-hashim/railway-project
- Repository: https://github.com/hsn-hashim/railway-project

## Overview

Smart RailWay is a browser-based train reservation system backed by Supabase. Travelers register or sign in, search trips, book seats, and manage tickets and profile details; administrators sign in to monitor operations and manage trips, trains, and customers. The excerpts show the main dashboard-to-Supabase interactions and the booking and seat-update behavior. The README documents additional capabilities, including QR tickets and statistics; those are represented, but unsampled page wiring and implementation details are not inferred.

Main entry points: [`login.js`](https://github.com/hsn-hashim/railway-project/blob/main/login.js) (Login flow), [`signup.js`](https://github.com/hsn-hashim/railway-project/blob/main/signup.js) (Registration flow), [`sign-in.html`](https://github.com/hsn-hashim/railway-project/blob/main/sign-in.html) (Sign in), [`sign-up.html`](https://github.com/hsn-hashim/railway-project/blob/main/sign-up.html) (Registration page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_welcome["Welcome page<br/>[index.html]"]
end

subgraph group_identity["Accounts"]
  node_sign_in["Sign in<br/>[sign-in.html]"]
  node_sign_up["Registration page<br/>[sign-up.html]"]
  node_login["Login flow<br/>[login.js]"]
  node_registration["Registration flow<br/>[signup.js]"]
end

subgraph group_traveler["Traveler services"]
  node_user_page["Traveler dashboard<br/>[userPage.html]"]
  node_user_dashboard["Traveler dashboard logic<br/>[userHomeScreen.js]"]
  node_trip_search["Trip search<br/>[userHomeScreen.js]"]
  node_booking["Seat booking<br/>[userHomeScreen.js]"]
  node_ticket_views["Tickets and history<br/>[userHomeScreen.js]"]
  node_qr_ticket["QR tickets<br/>[userHomeScreen.js]"]
  node_profile["Profile management<br/>[userHomeScreen.js]"]
end

subgraph group_operations["Administration"]
  node_admin_page["Admin dashboard<br/>[adminPage.html]"]
  node_admin_access["Admin access checks<br/>[adminHomeScreen.js]"]
  node_statistics["Live statistics<br/>[adminHomeScreen.js]"]
  node_trip_management["Trip management<br/>[adminHomeScreen.js]"]
  node_train_management["Train management<br/>[adminHomeScreen.js]"]
  node_customer_management["Customer tickets<br/>[adminHomeScreen.js]"]
end

node_traveler_actor(("Traveler"))
node_admin_actor(("Administrator"))
node_supabase[("Supabase Auth and data")]

node_traveler_actor -->|"opens app"| node_welcome
node_traveler_actor -->|"signs in"| node_sign_in
node_traveler_actor -->|"registers"| node_sign_up
node_admin_actor -->|"signs in"| node_sign_in
node_sign_in -->|"uses login"| node_login
node_login -->|"authenticates"| node_supabase
node_login -->|"routes admin"| node_admin_page
node_login -->|"routes traveler"| node_user_page
node_sign_up -->|"uses registration"| node_registration
node_registration -->|"creates account"| node_supabase
node_registration -->|"updates profile data"| node_supabase
node_user_page -.->|"dashboard logic"| node_user_dashboard
node_user_dashboard -->|"checks access"| node_supabase
node_trip_search -->|"reads trips"| node_supabase
node_booking -->|"writes tickets and seats"| node_supabase
node_ticket_views -->|"reads tickets"| node_supabase
node_qr_ticket -->|"generates ticket QR"| node_ticket_views
node_profile -->|"reads and updates profile"| node_supabase
node_admin_page -.->|"dashboard logic"| node_admin_access
node_admin_access -->|"checks role"| node_supabase
node_statistics -->|"reads operational data"| node_supabase
node_trip_management -->|"manages trips"| node_supabase
node_train_management -->|"updates train status"| node_supabase
node_customer_management -->|"cancels tickets and restores seats"| node_supabase

click node_welcome "https://github.com/hsn-hashim/railway-project/blob/main/index.html"
click node_sign_in "https://github.com/hsn-hashim/railway-project/blob/main/sign-in.html"
click node_sign_up "https://github.com/hsn-hashim/railway-project/blob/main/sign-up.html"
click node_login "https://github.com/hsn-hashim/railway-project/blob/main/login.js"
click node_registration "https://github.com/hsn-hashim/railway-project/blob/main/signup.js"
click node_user_page "https://github.com/hsn-hashim/railway-project/blob/main/userPage.html"
click node_user_dashboard "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_trip_search "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_booking "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_ticket_views "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_qr_ticket "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_profile "https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js"
click node_admin_page "https://github.com/hsn-hashim/railway-project/blob/main/adminPage.html"
click node_admin_access "https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js"
click node_statistics "https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js"
click node_trip_management "https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js"
click node_train_management "https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js"
click node_customer_management "https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.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_welcome toneBlue
class node_sign_in,node_sign_up,node_login,node_registration,node_supabase toneAmber
class node_user_page,node_user_dashboard,node_trip_search,node_booking,node_ticket_views,node_qr_ticket,node_profile toneMint
class node_admin_page,node_admin_access,node_statistics,node_trip_management,node_train_management,node_customer_management toneRose
class node_traveler_actor,node_admin_actor toneIndigo
```

## Components

### Web entry

- [Welcome page](https://github.com/hsn-hashim/railway-project/blob/main/index.html): `index.html`

### Accounts

- [Sign in](https://github.com/hsn-hashim/railway-project/blob/main/sign-in.html): `sign-in.html`
- [Registration page](https://github.com/hsn-hashim/railway-project/blob/main/sign-up.html): `sign-up.html`
- [Login flow](https://github.com/hsn-hashim/railway-project/blob/main/login.js): `login.js`
- [Registration flow](https://github.com/hsn-hashim/railway-project/blob/main/signup.js): `signup.js`

### Traveler services

- [Traveler dashboard](https://github.com/hsn-hashim/railway-project/blob/main/userPage.html): `userPage.html`
- [Traveler dashboard logic](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`
- [Trip search](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`
- [Seat booking](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`
- [Tickets and history](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`
- [QR tickets](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`
- [Profile management](https://github.com/hsn-hashim/railway-project/blob/main/userHomeScreen.js): `userHomeScreen.js`

### Administration

- [Admin dashboard](https://github.com/hsn-hashim/railway-project/blob/main/adminPage.html): `adminPage.html`
- [Admin access checks](https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js): `adminHomeScreen.js`
- [Live statistics](https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js): `adminHomeScreen.js`
- [Trip management](https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js): `adminHomeScreen.js`
- [Train management](https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js): `adminHomeScreen.js`
- [Customer tickets](https://github.com/hsn-hashim/railway-project/blob/main/adminHomeScreen.js): `adminHomeScreen.js`

### Other components

- **Traveler**
- **Administrator**
- **Supabase Auth and data**

## Connections

- Traveler → Welcome page: opens app (evidence: `README.md`)
- Traveler → Sign in: signs in (evidence: `README.md`)
- Traveler → Registration page: registers (evidence: `README.md`)
- Administrator → Sign in: signs in (evidence: `README.md`)
- Sign in → Login flow: uses login (evidence: `README.md`)
- Login flow → Supabase Auth and data: authenticates (evidence: `login.js`)
- Login flow → Admin dashboard: routes admin (evidence: `login.js`)
- Login flow → Traveler dashboard: routes traveler (evidence: `login.js`)
- Registration page → Registration flow: uses registration (evidence: `README.md`)
- Registration flow → Supabase Auth and data: creates account (evidence: `signup.js`)
- Registration flow → Supabase Auth and data: updates profile data (evidence: `signup.js`)
- Traveler dashboard → Traveler dashboard logic: dashboard logic
- Traveler dashboard logic → Supabase Auth and data: checks access (evidence: `userHomeScreen.js`)
- Trip search → Supabase Auth and data: reads trips (evidence: `userHomeScreen.js`)
- Seat booking → Supabase Auth and data: writes tickets and seats (evidence: `userHomeScreen.js`)
- Tickets and history → Supabase Auth and data: reads tickets (evidence: `userHomeScreen.js`)
- QR tickets → Tickets and history: generates ticket QR (evidence: `userHomeScreen.js`)
- Profile management → Supabase Auth and data: reads and updates profile (evidence: `userHomeScreen.js`)
- Admin dashboard → Admin access checks: dashboard logic
- Admin access checks → Supabase Auth and data: checks role (evidence: `adminHomeScreen.js`)
- Live statistics → Supabase Auth and data: reads operational data (evidence: `adminHomeScreen.js`)
- Trip management → Supabase Auth and data: manages trips (evidence: `adminHomeScreen.js`)
- Train management → Supabase Auth and data: updates train status (evidence: `adminHomeScreen.js`)
- Customer tickets → Supabase Auth and data: cancels tickets and restores seats (evidence: `adminHomeScreen.js`)
