# polasandeepreddy/metro architecture

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

- Interactive diagram: https://gitdiagram.com/polasandeepreddy/metro
- Repository: https://github.com/polasandeepreddy/metro

## Overview

Metro is a Django metro-ticket booking application. Users register or sign in, reach a protected home page, book a station-to-station ticket, and receive a ticket view with a generated QR code; profiles list their bookings. The app also implements password-reset handling and configures email delivery. The graph reflects the sampled views, models, forms, URL routing, and settings; template details and unsampled behavior are represented only at directory level, and the custom reset handler is not shown as routed.

Main entry points: [`metroapp/views.py`](https://github.com/polasandeepreddy/metro/blob/main/metroapp/views.py) (Page views), [`metroapp/models.py`](https://github.com/polasandeepreddy/metro/blob/main/metroapp/models.py) (User model), [`metro/urls.py`](https://github.com/polasandeepreddy/metro/blob/main/metro/urls.py) (Project routes), [`metroapp/urls.py`](https://github.com/polasandeepreddy/metro/blob/main/metroapp/urls.py) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and pages"]
  node_app_routes["App routes<br/>[urls.py]"]
  node_project_routes["Project routes<br/>[urls.py]"]
  node_page_views["Page views<br/>[views.py]"]
  node_page_templates["Page templates"]
end

subgraph group_identity["Accounts and authentication"]
  node_account_form["Registration form<br/>[forms.py]"]
  node_auth_backend["Phone-email backend<br/>[authentication.py]"]
  node_account_model["User model<br/>[models.py]"]
  node_django_auth["Django auth views"]
end

subgraph group_booking["Ticket booking"]
  node_ticket_model["Ticket model<br/>[models.py]"]
  node_qr_generator["QR generation"]
  node_qr_files["QR image files"]
end

subgraph group_infra["Persistence and delivery"]
  node_sqlite[("SQLite database<br/>[db.sqlite3]")]
  node_smtp["SMTP email"]
end

node_rider(("Rider"))

node_rider -->|"requests pages"| node_project_routes
node_project_routes -->|"includes routes"| node_app_routes
node_app_routes -->|"dispatches requests"| node_page_views
node_page_views -->|"renders pages"| node_page_templates
node_page_views -->|"validates registration"| node_account_form
node_account_form -->|"validates user fields"| node_account_model
node_page_views -->|"looks up users"| node_account_model
node_auth_backend -->|"authenticates users"| node_account_model
node_page_views -->|"creates and lists tickets"| node_ticket_model
node_ticket_model -->|"references user"| node_account_model
node_account_model -->|"persists accounts"| node_sqlite
node_ticket_model -->|"persists tickets"| node_sqlite
node_page_views -->|"generates QR code"| node_qr_generator
node_page_views -->|"saves QR image"| node_qr_files
node_page_views -->|"sends reset email"| node_smtp
node_app_routes -->|"routes reset views"| node_django_auth
node_page_views -->|"uses authentication"| node_django_auth
node_project_routes -.->|"configures mail delivery"| node_smtp
node_project_routes -->|"configures backend"| node_auth_backend

click node_app_routes "https://github.com/polasandeepreddy/metro/blob/main/metroapp/urls.py"
click node_project_routes "https://github.com/polasandeepreddy/metro/blob/main/metro/urls.py"
click node_page_views "https://github.com/polasandeepreddy/metro/blob/main/metroapp/views.py"
click node_page_templates "https://github.com/polasandeepreddy/metro/tree/main/metroapp/templates"
click node_account_form "https://github.com/polasandeepreddy/metro/blob/main/metroapp/forms.py"
click node_auth_backend "https://github.com/polasandeepreddy/metro/blob/main/metroapp/authentication.py"
click node_account_model "https://github.com/polasandeepreddy/metro/blob/main/metroapp/models.py"
click node_ticket_model "https://github.com/polasandeepreddy/metro/blob/main/metroapp/models.py"
click node_qr_files "https://github.com/polasandeepreddy/metro/tree/main/qrcodes"
click node_sqlite "https://github.com/polasandeepreddy/metro/blob/main/db.sqlite3"

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_routes,node_project_routes,node_page_views,node_page_templates toneBlue
class node_account_form,node_auth_backend,node_account_model,node_django_auth toneAmber
class node_ticket_model,node_qr_generator,node_qr_files toneMint
class node_sqlite,node_smtp toneRose
class node_rider toneIndigo
```

## Components

### Web entry and pages

- [App routes](https://github.com/polasandeepreddy/metro/blob/main/metroapp/urls.py): `metroapp/urls.py`
- [Project routes](https://github.com/polasandeepreddy/metro/blob/main/metro/urls.py): `metro/urls.py`
- [Page views](https://github.com/polasandeepreddy/metro/blob/main/metroapp/views.py): `metroapp/views.py`
- [Page templates](https://github.com/polasandeepreddy/metro/tree/main/metroapp/templates): `metroapp/templates`

### Accounts and authentication

- [Registration form](https://github.com/polasandeepreddy/metro/blob/main/metroapp/forms.py): `metroapp/forms.py`
- [Phone-email backend](https://github.com/polasandeepreddy/metro/blob/main/metroapp/authentication.py): `metroapp/authentication.py`
- [User model](https://github.com/polasandeepreddy/metro/blob/main/metroapp/models.py): `metroapp/models.py`
- **Django auth views**

### Ticket booking

- [Ticket model](https://github.com/polasandeepreddy/metro/blob/main/metroapp/models.py): `metroapp/models.py`
- **QR generation**
- [QR image files](https://github.com/polasandeepreddy/metro/tree/main/qrcodes): `qrcodes`

### Persistence and delivery

- [SQLite database](https://github.com/polasandeepreddy/metro/blob/main/db.sqlite3): `db.sqlite3`
- **SMTP email**

### Other components

- **Rider**

## Connections

- Rider → Project routes: requests pages
- Project routes → App routes: includes routes (evidence: `metro/urls.py`)
- App routes → Page views: dispatches requests (evidence: `metroapp/urls.py`)
- Page views → Page templates: renders pages (evidence: `metroapp/views.py`)
- Page views → Registration form: validates registration (evidence: `metroapp/views.py`)
- Registration form → User model: validates user fields (evidence: `metroapp/forms.py`)
- Page views → User model: looks up users (evidence: `metroapp/views.py`)
- Phone-email backend → User model: authenticates users (evidence: `metroapp/authentication.py`)
- Page views → Ticket model: creates and lists tickets (evidence: `metroapp/views.py`)
- Ticket model → User model: references user (evidence: `metroapp/models.py`)
- User model → SQLite database: persists accounts (evidence: `metroapp/models.py`)
- Ticket model → SQLite database: persists tickets (evidence: `metroapp/models.py`)
- Page views → QR generation: generates QR code (evidence: `metroapp/views.py`)
- Page views → QR image files: saves QR image (evidence: `metroapp/views.py`)
- Page views → SMTP email: sends reset email (evidence: `metroapp/views.py`)
- App routes → Django auth views: routes reset views (evidence: `metroapp/urls.py`)
- Page views → Django auth views: uses authentication (evidence: `metroapp/views.py`)
- Project routes → SMTP email: configures mail delivery
- Project routes → Phone-email backend: configures backend
