# yash-chhipa/ridehub architecture

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

- Interactive diagram: https://gitdiagram.com/yash-chhipa/ridehub
- Repository: https://github.com/yash-chhipa/ridehub

## Overview

RideHub is a Flask vehicle-rental web application. Customers register or log in, browse available vehicles, submit a booking with rental dates and payment method, and view or cancel rentals. Booking rules validate eligibility, availability, and pricing before recording a rental and payment record. Administrators manage vehicles, inspect customers and rental summaries, and update rental status. The sampled routes show the main workflows and a shared MySQL access layer; several template and database details are inferred only from the tree, so those links are omitted where unsupported.

Main entry points: [`app.py`](https://github.com/yash-chhipa/ridehub/blob/main/app.py) (Flask app), [`models/__init__.py`](https://github.com/yash-chhipa/ridehub/blob/main/models/__init__.py) (Database access), [`routes/rentals.py`](https://github.com/yash-chhipa/ridehub/blob/main/routes/rentals.py) (Booking requests), [`routes/admin.py`](https://github.com/yash-chhipa/ridehub/blob/main/routes/admin.py) (Admin operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_flask_app["Flask app<br/>[app.py]"]
  node_access_control["Access control<br/>[decorators.py]"]
end

subgraph group_customer["Customer journeys"]
  node_auth_routes["Authentication<br/>[auth.py]"]
  node_customer_home["Customer home<br/>[customer.py]"]
  node_vehicle_routes["Vehicle catalog<br/>[vehicles.py]"]
  node_booking_routes["Booking requests<br/>[rentals.py]"]
  node_booking_rules["Booking rules<br/>[booking.py]"]
  node_home_view["Home page<br/>[home.html]"]
  node_vehicle_views["Vehicle pages"]
  node_booking_view["Booking page<br/>[booking.html]"]
end

subgraph group_operations["Rental operations"]
  node_rental_management["Rental management<br/>[rentals.py]"]
  node_admin_operations["Admin operations<br/>[admin.py]"]
  node_rental_views["Rental pages"]
  node_admin_views["Admin pages"]
end

subgraph group_persistence["Persistence"]
  node_data_access["Database access<br/>[__init__.py]"]
  node_mysql[("MySQL database")]
end

node_customer_actor(("Customer"))
node_admin_actor(("Administrator"))

node_flask_app -->|"registers routes"| node_auth_routes
node_flask_app -->|"registers routes"| node_customer_home
node_flask_app -->|"registers routes"| node_admin_operations
node_flask_app -->|"registers routes"| node_vehicle_routes
node_flask_app -->|"registers routes"| node_booking_routes
node_flask_app -->|"initializes"| node_data_access
node_customer_actor -.->|"uses"| node_flask_app
node_admin_actor -.->|"uses"| node_flask_app
node_auth_routes -->|"queries and writes"| node_data_access
node_auth_routes -.->|"uses guards"| node_access_control
node_customer_home -->|"renders"| node_home_view
node_vehicle_routes -->|"queries"| node_data_access
node_vehicle_routes -->|"renders"| node_vehicle_views
node_booking_routes -->|"creates or cancels"| node_booking_rules
node_booking_routes -->|"queries"| node_data_access
node_booking_routes -->|"uses guards"| node_access_control
node_booking_routes -->|"renders"| node_booking_view
node_booking_routes -->|"renders"| node_rental_views
node_booking_rules -->|"reads and writes"| node_data_access
node_admin_operations -->|"queries and writes"| node_data_access
node_admin_operations -->|"uses guard"| node_access_control
node_admin_operations -->|"redirects rentals"| node_rental_management
node_admin_operations -->|"renders"| node_admin_views
node_rental_management -->|"renders"| node_rental_views
node_data_access -->|"queries and commits"| node_mysql

click node_flask_app "https://github.com/yash-chhipa/ridehub/blob/main/app.py"
click node_auth_routes "https://github.com/yash-chhipa/ridehub/blob/main/routes/auth.py"
click node_access_control "https://github.com/yash-chhipa/ridehub/blob/main/routes/decorators.py"
click node_customer_home "https://github.com/yash-chhipa/ridehub/blob/main/routes/customer.py"
click node_vehicle_routes "https://github.com/yash-chhipa/ridehub/blob/main/routes/vehicles.py"
click node_booking_routes "https://github.com/yash-chhipa/ridehub/blob/main/routes/rentals.py"
click node_booking_rules "https://github.com/yash-chhipa/ridehub/blob/main/models/booking.py"
click node_rental_management "https://github.com/yash-chhipa/ridehub/blob/main/routes/rentals.py"
click node_admin_operations "https://github.com/yash-chhipa/ridehub/blob/main/routes/admin.py"
click node_home_view "https://github.com/yash-chhipa/ridehub/blob/main/templates/customer/home.html"
click node_vehicle_views "https://github.com/yash-chhipa/ridehub/tree/main/templates/vehicles"
click node_booking_view "https://github.com/yash-chhipa/ridehub/blob/main/templates/customer/booking.html"
click node_rental_views "https://github.com/yash-chhipa/ridehub/tree/main/templates/rentals"
click node_admin_views "https://github.com/yash-chhipa/ridehub/tree/main/templates/admin"
click node_data_access "https://github.com/yash-chhipa/ridehub/blob/main/models/__init__.py"

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_flask_app,node_access_control toneBlue
class node_auth_routes,node_customer_home,node_vehicle_routes,node_booking_routes,node_booking_rules,node_home_view,node_vehicle_views,node_booking_view toneAmber
class node_rental_management,node_admin_operations,node_rental_views,node_admin_views toneMint
class node_data_access,node_mysql toneRose
class node_customer_actor,node_admin_actor toneIndigo
```

## Components

### Web entry

- [Flask app](https://github.com/yash-chhipa/ridehub/blob/main/app.py): `app.py`
- [Access control](https://github.com/yash-chhipa/ridehub/blob/main/routes/decorators.py): `routes/decorators.py`

### Customer journeys

- [Authentication](https://github.com/yash-chhipa/ridehub/blob/main/routes/auth.py): `routes/auth.py`
- [Customer home](https://github.com/yash-chhipa/ridehub/blob/main/routes/customer.py): `routes/customer.py`
- [Vehicle catalog](https://github.com/yash-chhipa/ridehub/blob/main/routes/vehicles.py): `routes/vehicles.py`
- [Booking requests](https://github.com/yash-chhipa/ridehub/blob/main/routes/rentals.py): `routes/rentals.py`
- [Booking rules](https://github.com/yash-chhipa/ridehub/blob/main/models/booking.py): `models/booking.py`
- [Home page](https://github.com/yash-chhipa/ridehub/blob/main/templates/customer/home.html): `templates/customer/home.html`
- [Vehicle pages](https://github.com/yash-chhipa/ridehub/tree/main/templates/vehicles): `templates/vehicles`
- [Booking page](https://github.com/yash-chhipa/ridehub/blob/main/templates/customer/booking.html): `templates/customer/booking.html`

### Rental operations

- [Rental management](https://github.com/yash-chhipa/ridehub/blob/main/routes/rentals.py): `routes/rentals.py`
- [Admin operations](https://github.com/yash-chhipa/ridehub/blob/main/routes/admin.py): `routes/admin.py`
- [Rental pages](https://github.com/yash-chhipa/ridehub/tree/main/templates/rentals): `templates/rentals`
- [Admin pages](https://github.com/yash-chhipa/ridehub/tree/main/templates/admin): `templates/admin`

### Persistence

- [Database access](https://github.com/yash-chhipa/ridehub/blob/main/models/__init__.py): `models/__init__.py`
- **MySQL database**

### Other components

- **Customer**
- **Administrator**

## Connections

- Flask app → Authentication: registers routes (evidence: `app.py`)
- Flask app → Customer home: registers routes (evidence: `app.py`)
- Flask app → Admin operations: registers routes (evidence: `app.py`)
- Flask app → Vehicle catalog: registers routes (evidence: `app.py`)
- Flask app → Booking requests: registers routes (evidence: `app.py`)
- Flask app → Database access: initializes (evidence: `app.py`)
- Customer → Flask app: uses
- Administrator → Flask app: uses
- Authentication → Database access: queries and writes (evidence: `routes/auth.py`)
- Authentication → Access control: uses guards
- Customer home → Home page: renders (evidence: `routes/customer.py`)
- Vehicle catalog → Database access: queries (evidence: `routes/vehicles.py`)
- Vehicle catalog → Vehicle pages: renders (evidence: `routes/vehicles.py`)
- Booking requests → Booking rules: creates or cancels (evidence: `routes/rentals.py`)
- Booking requests → Database access: queries (evidence: `routes/rentals.py`)
- Booking requests → Access control: uses guards (evidence: `routes/rentals.py`)
- Booking requests → Booking page: renders (evidence: `routes/rentals.py`)
- Booking requests → Rental pages: renders (evidence: `routes/rentals.py`)
- Booking rules → Database access: reads and writes (evidence: `models/booking.py`)
- Admin operations → Database access: queries and writes (evidence: `routes/admin.py`)
- Admin operations → Access control: uses guard (evidence: `routes/admin.py`)
- Admin operations → Rental management: redirects rentals (evidence: `routes/admin.py`)
- Admin operations → Admin pages: renders (evidence: `routes/admin.py`)
- Rental management → Rental pages: renders (evidence: `routes/rentals.py`)
- Database access → MySQL database: queries and commits (evidence: `models/__init__.py`)
