How juan-419/proyecto_des works
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 Database Sessions · main.py FastAPI App · models.py SQLModel Entities · carro.py Vehicles
Components 17
Application Runtime
- FastAPI App · Assembles the application and functional modules.
main.py - Python Dependencies
requirements.txt
HTTP Modules
- Customers · Customer lifecycle and customer-owned vehicle views.
cliente.py - Vehicles · Vehicle lifecycle and customer association.
carro.py - Mechanics · Mechanic lifecycle.
mecanico.py - Repairs · Repair operations and mechanic assignment.
reparacion.py - SOAT · SOAT records and functions.
soat.py - Dashboard · Computes aggregate operational metrics.
dashboard.py - Reports · Reporting boundary.
reporte.py
Domain & Persistence
- SQLModel Entities · Defines entities, relationships, and the repair–mechanic link.
models.py - Database Sessions · Owns relational database and session setup.
db.py
Browser UI
- Jinja2 Templates · Shared layout and resource-specific browser pages.
- Repair Pages · New, edit, active-list, and deleted-repair pages.
templates/reparacion_list.html - Dashboard Page
templates/dashboard.html
External Services
- SQLite · Documented relational persistence option.
- Image Upload Adapter · Uploads customer or vehicle images and saves accessible URLs.
supa/supabase_upload.py - Supabase Storage · Public object storage for images.
Connections 27
- 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