# juan-419/proyecto_des architecture

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

- Interactive diagram: https://gitdiagram.com/juan-419/proyecto_des
- Repository: https://github.com/juan-419/proyecto_des

## Overview

#### Purpose and startup

AutoFix Pro is a server-rendered automotive workshop management system. It manages customers, their vehicles, mechanics, repairs, SOAT records, dashboard metrics, and reports. The FastAPI application entry point is `main.py`; local execution uses `uvicorn main:app --reload`. HTML is rendered through Jinja2 templates in `templates/`.

#### Application composition and routing

`main.py` assembles the FastAPI app and exposes or mounts the functional modules. Domain-oriented route handlers are separated by resource:
- Customer lifecycle: `cliente.py`
- Vehicle lifecycle and customer association: `carro.py`
- Mechanic lifecycle: `mecanico.py`
- Repair registration and mechanic assignment: `reparacion.py`
- Dashboard metrics: `dashboard.py`
- SOAT and reporting functions: `soat.py`, `reporte.py`

These modules form the HTTP boundary for both browser pages and the documented API-oriented repair functionality.

#### Persistence and domain model

`models.py` defines SQLModel entities, fields, relationship mappings, and the repair–mechanic link model. The central relationship graph is:
- Cliente 1:N Carro
- Carro 1:1 SOAT
- Carro 1:N Reparacion
- Reparacion N:M Mecanico

`db.py` owns database/session setup and is the persistence boundary used by route modules. Entities support logical deletion through an `active` flag rather than immediate physical removal; list and “eliminados” views separate active and inactive records.

#### Customer and vehicle workflow

Customer creation/editing/listing originates in `cliente.py` and is presented through `templates/cliente_list.html`, `templates/cliente_carros.html`, and related edit/card templates. Vehicles are created under a customer and managed through `carro.py`; `templates/carro_list.html` and `templates/carro_servicios.html` expose vehicle inventory and its service history. This customer → vehicle hierarchy is the primary ownership path for repairs and SOAT data.

#### Repair operations

`reparacion.py` is the operational core: it creates, edits, lists, soft-deletes, and restores repair records tied to a vehicle. It also manages the many-to-many assignment of mechanics represented in `models.py`. The primary UI stages are `templates/reparacion_new.html`, `templates/reparacion_edit.html`, and `templates/reparacion_list.html`; inactive repairs are isolated in `templates/reparacion_eliminadas.html`.

#### Presentation, dashboard, and reports

Jinja2 templates provide the browser UI, with shared layout fragments in `templates/navbar.html`, `templates/header.html`, and `templates/footer.html`. `dashboard.py` computes aggregate counts for customers, vehicles, mechanics, and active repairs, rendered by `templates/dashboard.html`. `reporte.py` is the reporting boundary, while `templates/index.html` provides the landing view.

#### External services and runtime

The application runs on Python/FastAPI with SQLModel and Jinja2; declared deployment/runtime artifacts are `requirements.txt` and `runtime.txt`, consistent with Render deployment. Supabase is used specifically for public object storage, not necessarily as the primary relational database: `supa/supabase_upload.py` uploads customer or vehicle images and persists their accessible URLs through the domain data layer. The README describes SQLite as the relational persistence option.

Main entry points: [`db.py`](https://github.com/juan-419/proyecto_des/blob/master/db.py) (Database Sessions), [`main.py`](https://github.com/juan-419/proyecto_des/blob/master/main.py) (FastAPI App), [`models.py`](https://github.com/juan-419/proyecto_des/blob/master/models.py) (SQLModel Entities), [`carro.py`](https://github.com/juan-419/proyecto_des/blob/master/carro.py) (Vehicles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application Runtime"]
  node_main{{"FastAPI App<br/>application entry<br/>[main.py]"}}
  node_requirements["Python Dependencies<br/>runtime manifest<br/>[requirements.txt]"]
end

subgraph group_http["HTTP Modules"]
  node_cliente["Customers<br/>route module<br/>[cliente.py]"]
  node_carro["Vehicles<br/>route module<br/>[carro.py]"]
  node_mecanico["Mechanics<br/>route module<br/>[mecanico.py]"]
  node_reparacion["Repairs<br/>route module<br/>[reparacion.py]"]
  node_soat["SOAT<br/>route module<br/>[soat.py]"]
  node_dashboard["Dashboard<br/>route module<br/>[dashboard.py]"]
  node_reporte["Reports<br/>route module<br/>[reporte.py]"]
end

subgraph group_domain["Domain &amp; Persistence"]
  node_models["SQLModel Entities<br/>domain model<br/>[models.py]"]
  node_db[("Database Sessions<br/>persistence boundary<br/>[db.py]")]
end

subgraph group_presentation["Browser UI"]
  node_templates["Jinja2 Templates<br/>server-rendered UI"]
  node_repair_ui["Repair Pages<br/>template flow"]
  node_dashboard_ui["Dashboard Page<br/>template page<br/>[dashboard.html]"]
end

subgraph group_external["External Services"]
  node_sqlite[("SQLite<br/>relational database")]
  node_storage_upload["Image Upload Adapter<br/>storage integration<br/>[supabase_upload.py]"]
  node_supabase[("Supabase Storage<br/>object storage")]
end

node_requirements -.->|"provides runtime packages"| node_main
node_main -->|"registers"| node_cliente
node_main -->|"registers"| node_carro
node_main -->|"registers"| node_mecanico
node_main -->|"registers"| node_reparacion
node_main -->|"registers"| node_soat
node_main -->|"registers"| node_dashboard
node_main -->|"registers"| node_reporte
node_cliente -->|"persists customers"| node_db
node_carro -->|"persists vehicles"| node_db
node_mecanico -->|"persists mechanics"| node_db
node_reparacion -->|"persists repairs"| node_db
node_soat -->|"persists SOAT"| node_db
node_dashboard -->|"aggregates active records"| node_db
node_reporte -->|"queries report data"| node_db
node_db -->|"uses mapped entities"| node_models
node_db -->|"connects to"| node_sqlite
node_models -->|"Cliente 1:N Carro"| node_carro
node_models -->|"Carro 1:1 SOAT"| node_soat
node_models -->|"Carro 1:N Reparacion; Reparacion N:M Mecanico"| node_reparacion
node_cliente -->|"renders customer pages"| node_templates
node_carro -->|"renders vehicle pages"| node_templates
node_mecanico -->|"renders mechanic pages"| node_templates
node_reparacion -->|"renders"| node_repair_ui
node_dashboard -->|"renders metrics"| node_dashboard_ui
node_storage_upload -->|"uploads images"| node_supabase
node_storage_upload -->|"persists image URLs"| node_db

click node_main "https://github.com/juan-419/proyecto_des/blob/master/main.py"
click node_requirements "https://github.com/juan-419/proyecto_des/blob/master/requirements.txt"
click node_cliente "https://github.com/juan-419/proyecto_des/blob/master/cliente.py"
click node_carro "https://github.com/juan-419/proyecto_des/blob/master/carro.py"
click node_mecanico "https://github.com/juan-419/proyecto_des/blob/master/mecanico.py"
click node_reparacion "https://github.com/juan-419/proyecto_des/blob/master/reparacion.py"
click node_soat "https://github.com/juan-419/proyecto_des/blob/master/soat.py"
click node_dashboard "https://github.com/juan-419/proyecto_des/blob/master/dashboard.py"
click node_reporte "https://github.com/juan-419/proyecto_des/blob/master/reporte.py"
click node_models "https://github.com/juan-419/proyecto_des/blob/master/models.py"
click node_db "https://github.com/juan-419/proyecto_des/blob/master/db.py"
click node_repair_ui "https://github.com/juan-419/proyecto_des/blob/master/templates/reparacion_list.html"
click node_dashboard_ui "https://github.com/juan-419/proyecto_des/blob/master/templates/dashboard.html"
click node_storage_upload "https://github.com/juan-419/proyecto_des/blob/master/supa/supabase_upload.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_main,node_requirements toneBlue
class node_cliente,node_carro,node_mecanico,node_reparacion,node_soat,node_dashboard,node_reporte toneAmber
class node_models,node_db toneMint
class node_templates,node_repair_ui,node_dashboard_ui toneRose
class node_sqlite,node_storage_upload,node_supabase toneIndigo
```

## Components

### Application Runtime

- [FastAPI App](https://github.com/juan-419/proyecto_des/blob/master/main.py): application entry · Assembles the application and functional modules. · `main.py`
- [Python Dependencies](https://github.com/juan-419/proyecto_des/blob/master/requirements.txt): runtime manifest · `requirements.txt`

### HTTP Modules

- [Customers](https://github.com/juan-419/proyecto_des/blob/master/cliente.py): route module · Customer lifecycle and customer-owned vehicle views. · `cliente.py`
- [Vehicles](https://github.com/juan-419/proyecto_des/blob/master/carro.py): route module · Vehicle lifecycle and customer association. · `carro.py`
- [Mechanics](https://github.com/juan-419/proyecto_des/blob/master/mecanico.py): route module · Mechanic lifecycle. · `mecanico.py`
- [Repairs](https://github.com/juan-419/proyecto_des/blob/master/reparacion.py): route module · Repair operations and mechanic assignment. · `reparacion.py`
- [SOAT](https://github.com/juan-419/proyecto_des/blob/master/soat.py): route module · SOAT records and functions. · `soat.py`
- [Dashboard](https://github.com/juan-419/proyecto_des/blob/master/dashboard.py): route module · Computes aggregate operational metrics. · `dashboard.py`
- [Reports](https://github.com/juan-419/proyecto_des/blob/master/reporte.py): route module · Reporting boundary. · `reporte.py`

### Domain & Persistence

- [SQLModel Entities](https://github.com/juan-419/proyecto_des/blob/master/models.py): domain model · Defines entities, relationships, and the repair–mechanic link. · `models.py`
- [Database Sessions](https://github.com/juan-419/proyecto_des/blob/master/db.py): persistence boundary · Owns relational database and session setup. · `db.py`

### Browser UI

- **Jinja2 Templates**: server-rendered UI · Shared layout and resource-specific browser pages.
- [Repair Pages](https://github.com/juan-419/proyecto_des/blob/master/templates/reparacion_list.html): template flow · New, edit, active-list, and deleted-repair pages. · `templates/reparacion_list.html`
- [Dashboard Page](https://github.com/juan-419/proyecto_des/blob/master/templates/dashboard.html): template page · `templates/dashboard.html`

### External Services

- **SQLite**: relational database · Documented relational persistence option.
- [Image Upload Adapter](https://github.com/juan-419/proyecto_des/blob/master/supa/supabase_upload.py): storage integration · Uploads customer or vehicle images and saves accessible URLs. · `supa/supabase_upload.py`
- **Supabase Storage**: object storage · Public object storage for images.

## Connections

- Python Dependencies → FastAPI App: provides runtime packages
- FastAPI App → Customers: registers
- FastAPI App → Vehicles: registers
- FastAPI App → Mechanics: registers
- FastAPI App → Repairs: registers
- FastAPI App → SOAT: registers
- FastAPI App → Dashboard: registers
- FastAPI App → Reports: registers
- Customers → Database Sessions: persists customers
- Vehicles → Database Sessions: persists vehicles
- Mechanics → Database Sessions: persists mechanics
- Repairs → Database Sessions: persists repairs
- SOAT → Database Sessions: persists SOAT
- Dashboard → Database Sessions: aggregates active records
- Reports → Database Sessions: queries report data
- Database Sessions → SQLModel Entities: uses mapped entities
- Database Sessions → SQLite: connects to
- SQLModel Entities → Vehicles: Cliente 1:N Carro
- SQLModel Entities → SOAT: Carro 1:1 SOAT
- SQLModel Entities → Repairs: Carro 1:N Reparacion; Reparacion N:M Mecanico
- Customers → Jinja2 Templates: renders customer pages
- Vehicles → Jinja2 Templates: renders vehicle pages
- Mechanics → Jinja2 Templates: renders mechanic pages
- Repairs → Repair Pages: renders
- Dashboard → Dashboard Page: renders metrics
- Image Upload Adapter → Supabase Storage: uploads images
- Image Upload Adapter → Database Sessions: persists image URLs
