# sutharv/rental_system architecture

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

- Interactive diagram: https://gitdiagram.com/sutharv/rental_system
- Repository: https://github.com/sutharv/rental_system

## Overview

This is a Flask rental-management application for bike/car inventory, customers, rentals, returns, and history. A browser request enters the Flask app and route handlers, which use RentalManager for validation and operations; rental flows update item/customer state, and the manager persists data to JSON. The route layer also supports searches, availability views, customer editing, and item/customer history pages. Source excerpts show the main calls and persistence behavior; broader capabilities such as removal and search are also documented in the README.

Main entry points: [`app/rental_manager.py`](https://github.com/sutharv/rental_system/blob/main/app/rental_manager.py) (Rental manager), [`app/routes.py`](https://github.com/sutharv/rental_system/blob/main/app/routes.py) (Route handlers), [`app/app.py`](https://github.com/sutharv/rental_system/blob/main/app/app.py) (Flask app), [`app/models.py`](https://github.com/sutharv/rental_system/blob/main/app/models.py) (Rental item models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_flask_app["Flask app<br/>[app.py]"]
  node_route_handlers["Route handlers<br/>[routes.py]"]
  node_page_templates["Page templates"]
end

subgraph group_operations["Rental operations"]
  node_item_management["Item management<br/>[routes.py]"]
  node_customer_management["Customer management<br/>[routes.py]"]
  node_rental_flow["Rental and returns<br/>[routes.py]"]
  node_search_views["Search and availability<br/>[routes.py]"]
  node_history_views["Rental histories<br/>[routes.py]"]
  node_rental_manager["Rental manager<br/>[rental_manager.py]"]
end

subgraph group_domain["Domain models"]
  node_rental_items["Rental item models<br/>[models.py]"]
  node_customer_model["Customer model<br/>[customer.py]"]
end

subgraph group_persistence["Persistence"]
  node_json_store[("JSON data store<br/>[data.json]")]
end

node_browser(("Browser"))

node_browser -->|"sends requests"| node_flask_app
node_flask_app -->|"registers routes"| node_route_handlers
node_route_handlers -->|"calls operations"| node_rental_manager
node_route_handlers -->|"creates items"| node_rental_items
node_route_handlers -->|"creates customers"| node_customer_model
node_route_handlers -->|"renders pages"| node_page_templates
node_rental_manager -->|"updates item state"| node_rental_items
node_rental_manager -->|"updates rentals"| node_customer_model
node_rental_manager -->|"loads and saves"| node_json_store
node_item_management -->|"delegates item actions"| node_rental_manager
node_customer_management -->|"delegates customer actions"| node_rental_manager
node_rental_flow -->|"rents and returns"| node_rental_manager
node_search_views -->|"searches inventory"| node_rental_manager
node_history_views -->|"requests histories"| node_rental_manager

click node_flask_app "https://github.com/sutharv/rental_system/blob/main/app/app.py"
click node_route_handlers "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_page_templates "https://github.com/sutharv/rental_system/tree/main/app/templates"
click node_item_management "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_customer_management "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_rental_flow "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_search_views "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_history_views "https://github.com/sutharv/rental_system/blob/main/app/routes.py"
click node_rental_manager "https://github.com/sutharv/rental_system/blob/main/app/rental_manager.py"
click node_rental_items "https://github.com/sutharv/rental_system/blob/main/app/models.py"
click node_customer_model "https://github.com/sutharv/rental_system/blob/main/app/customer.py"
click node_json_store "https://github.com/sutharv/rental_system/blob/main/data.json"

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_route_handlers,node_page_templates,node_browser toneBlue
class node_item_management,node_customer_management,node_rental_flow,node_search_views,node_history_views,node_rental_manager toneAmber
class node_rental_items,node_customer_model toneMint
class node_json_store toneRose
```

## Components

### Web interface

- [Flask app](https://github.com/sutharv/rental_system/blob/main/app/app.py): `app/app.py`
- [Route handlers](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Page templates](https://github.com/sutharv/rental_system/tree/main/app/templates): `app/templates`

### Rental operations

- [Item management](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Customer management](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Rental and returns](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Search and availability](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Rental histories](https://github.com/sutharv/rental_system/blob/main/app/routes.py): `app/routes.py`
- [Rental manager](https://github.com/sutharv/rental_system/blob/main/app/rental_manager.py): `app/rental_manager.py`

### Domain models

- [Rental item models](https://github.com/sutharv/rental_system/blob/main/app/models.py): `app/models.py`
- [Customer model](https://github.com/sutharv/rental_system/blob/main/app/customer.py): `app/customer.py`

### Persistence

- [JSON data store](https://github.com/sutharv/rental_system/blob/main/data.json): `data.json`

### Other components

- **Browser**

## Connections

- Browser → Flask app: sends requests (evidence: `README.md`)
- Flask app → Route handlers: registers routes (evidence: `app/app.py`)
- Route handlers → Rental manager: calls operations (evidence: `app/routes.py`)
- Route handlers → Rental item models: creates items (evidence: `app/routes.py`)
- Route handlers → Customer model: creates customers (evidence: `app/routes.py`)
- Route handlers → Page templates: renders pages (evidence: `app/routes.py`)
- Rental manager → Rental item models: updates item state (evidence: `app/rental_manager.py`)
- Rental manager → Customer model: updates rentals (evidence: `app/rental_manager.py`)
- Rental manager → JSON data store: loads and saves (evidence: `README.md`)
- Item management → Rental manager: delegates item actions (evidence: `app/routes.py`)
- Customer management → Rental manager: delegates customer actions (evidence: `app/routes.py`)
- Rental and returns → Rental manager: rents and returns (evidence: `app/routes.py`)
- Search and availability → Rental manager: searches inventory (evidence: `app/routes.py`)
- Rental histories → Rental manager: requests histories (evidence: `app/routes.py`)
