# dan1l-git/flask-dealership-mvc architecture

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

- Interactive diagram: https://gitdiagram.com/dan1l-git/flask-dealership-mvc
- Repository: https://github.com/dan1l-git/flask-dealership-mvc

## Overview

Мрія is a Flask car-dealership web app. A visitor browses available cars and their details; a registered customer can review or favorite a car and place an order, while an administrator manages cars and their images. Routes coordinate forms, persistence, and rendered pages. The README also documents a credit calculator, represented as a page capability; its implementation was not sampled. The graph reflects the shown route and ORM interactions; relationships for unsampled page behavior are documented in the README.

Main entry points: [`app/routes.py`](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py) (Route handlers), [`app/models.py`](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/models.py) (Domain models), [`run.py`](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/run.py) (Flask entrypoint), [`app/__init__.py`](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/__init__.py) (App factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_runtime["Flask entrypoint<br/>[run.py]"]
  node_factory["App factory<br/>[__init__.py]"]
  node_routes["Route handlers<br/>[routes.py]"]
  node_forms["Form validation<br/>[forms.py]"]
end

subgraph group_customer["Customer features"]
  node_customer_pages["Customer pages"]
  node_auth["Authentication<br/>[routes.py]"]
  node_catalog["Car catalog<br/>[routes.py]"]
  node_reviews["Car reviews<br/>[routes.py]"]
  node_favorites["Saved cars<br/>[routes.py]"]
  node_orders["Car orders<br/>[routes.py]"]
  node_calculator["Credit calculator"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin pages"]
  node_admin_cars["Car management<br/>[routes.py]"]
  node_image_management["Image management<br/>[routes.py]"]
end

subgraph group_data["Domain and persistence"]
  node_models["Domain models<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
  node_image_files[("Image files")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens app"| node_runtime
node_runtime -->|"creates app"| node_factory
node_factory -->|"registers routes"| node_routes
node_visitor -->|"requests pages"| node_routes
node_routes -->|"validates input"| node_forms
node_forms -->|"checks email"| node_models
node_routes -->|"queries and saves"| node_models
node_routes -->|"renders pages"| node_customer_pages
node_routes -->|"renders pages"| node_admin_pages
node_routes -->|"handles sign-in"| node_auth
node_routes -->|"serves catalog"| node_catalog
node_routes -->|"records reviews"| node_reviews
node_routes -->|"updates favorites"| node_favorites
node_routes -->|"creates orders"| node_orders
node_routes -->|"manages cars"| node_admin_cars
node_routes -->|"manages images"| node_image_management
node_routes -->|"persists records"| node_postgres
node_routes -->|"writes and deletes"| node_image_files
node_customer_pages -.->|"offers calculator"| node_calculator
node_models -->|"maps domain data"| node_postgres

click node_runtime "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/run.py"
click node_factory "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/__init__.py"
click node_routes "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_customer_pages "https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates"
click node_admin_pages "https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates"
click node_forms "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/forms.py"
click node_auth "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_catalog "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_reviews "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_favorites "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_orders "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_calculator "https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates"
click node_admin_cars "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_image_management "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py"
click node_models "https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/models.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_runtime,node_factory,node_routes,node_forms toneBlue
class node_customer_pages,node_auth,node_catalog,node_reviews,node_favorites,node_orders,node_calculator toneAmber
class node_admin_pages,node_admin_cars,node_image_management toneMint
class node_models,node_postgres,node_image_files toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Flask entrypoint](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/run.py): `run.py`
- [App factory](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/__init__.py): `app/__init__.py`
- [Route handlers](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Form validation](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/forms.py): `app/forms.py`

### Customer features

- [Customer pages](https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates): `app/templates`
- [Authentication](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Car catalog](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Car reviews](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Saved cars](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Car orders](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Credit calculator](https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates): `app/templates`

### Administration

- [Admin pages](https://github.com/dan1l-git/flask-dealership-mvc/tree/main/app/templates): `app/templates`
- [Car management](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`
- [Image management](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/routes.py): `app/routes.py`

### Domain and persistence

- [Domain models](https://github.com/dan1l-git/flask-dealership-mvc/blob/main/app/models.py): `app/models.py`
- **PostgreSQL**
- **Image files**

### Other components

- **Visitor**

## Connections

- Visitor → Flask entrypoint: opens app (evidence: `README.md`)
- Flask entrypoint → App factory: creates app (evidence: `run.py`)
- App factory → Route handlers: registers routes (evidence: `app/__init__.py`)
- Visitor → Route handlers: requests pages (evidence: `README.md`)
- Route handlers → Form validation: validates input (evidence: `app/routes.py`)
- Form validation → Domain models: checks email (evidence: `app/forms.py`)
- Route handlers → Domain models: queries and saves (evidence: `app/routes.py`)
- Route handlers → Customer pages: renders pages (evidence: `app/routes.py`)
- Route handlers → Admin pages: renders pages (evidence: `app/routes.py`)
- Route handlers → Authentication: handles sign-in (evidence: `app/routes.py`)
- Route handlers → Car catalog: serves catalog (evidence: `app/routes.py`)
- Route handlers → Car reviews: records reviews (evidence: `app/routes.py`)
- Route handlers → Saved cars: updates favorites (evidence: `app/routes.py`)
- Route handlers → Car orders: creates orders (evidence: `app/routes.py`)
- Route handlers → Car management: manages cars (evidence: `app/routes.py`)
- Route handlers → Image management: manages images (evidence: `app/routes.py`)
- Route handlers → PostgreSQL: persists records (evidence: `app/routes.py`)
- Route handlers → Image files: writes and deletes (evidence: `app/routes.py`)
- Customer pages → Credit calculator: offers calculator (evidence: `README.md`)
- Domain models → PostgreSQL: maps domain data (evidence: `README.md`)
