# oyarzabalvalentin174-beep/motomecanica architecture

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

- Interactive diagram: https://gitdiagram.com/oyarzabalvalentin174-beep/motomecanica
- Repository: https://github.com/oyarzabalvalentin174-beep/motomecanica

## Overview

This is a Spanish-language workshop and retail management application: staff manage inventory, sales, returns, estimates, technical records, and reporting through a Next.js interface. The principal workflow is a staff member entering an operation in a client view, sending it to an API route, and having that route invoke the database layer; the clearest sampled example is inventory editing. Major features are represented from the file tree, but most page wiring and endpoint calls were not excerpted, so those links are omitted or marked unverified.

Main entry points: [`taller/components/db.js`](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/db.js) (Database access), [`taller/components/PresupuestosClient.js`](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/PresupuestosClient.js) (Estimates), [`taller/app/api/perfil/route.js`](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/perfil/route.js) (User profile), [`taller/app/api/auth/[...nextauth]/route.js`](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/auth/%5B...nextauth%5D/route.js) (Credentials sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and profile"]
  node_auth["Credentials sign-in<br/>[route.js]"]
  node_profile["User profile<br/>[route.js]"]
  node_users["User administration<br/>[UsuariosClient.js]"]
end

subgraph group_operations["Workshop operations"]
  node_stock["Inventory management<br/>[StockClient.js]"]
  node_stock_api["Inventory API<br/>[route.js]"]
  node_returns["Returns"]
  node_return_history["Return history"]
  node_technical["Technical records"]
  node_personal_use["Personal use"]
  node_personal_api["Personal-use API<br/>[route.js]"]
  node_brands["Brand catalog<br/>[MarcasClient.js]"]
  node_price_adjust["Price adjustments"]
end

subgraph group_commerce["Sales and estimates"]
  node_sales["Sales entry<br/>[VentaClient.js]"]
  node_sales_api["Sales API<br/>[route.js]"]
  node_sales_history["Sales history<br/>[VerVentasClient.js]"]
  node_estimates["Estimates"]
  node_estimate_import["Estimate import"]
  node_estimate_export["Estimate spreadsheet"]
  node_estimate_pdf["Estimate PDF"]
end

subgraph group_insights["Reporting"]
  node_reports_list["Report listings"]
  node_reports_charts["Report charts"]
  node_reports_export["Report export<br/>[reportesExcel.js]"]
end

subgraph group_platform["Shared runtime"]
  node_db[("Database access<br/>[db.js]")]
end

node_staff(("Workshop staff"))

node_staff -->|"signs in"| node_auth
node_auth -->|"checks credentials"| node_db
node_staff -.->|"updates profile"| node_profile
node_profile -->|"checks session"| node_auth
node_profile -->|"reads and writes"| node_db
node_staff -.->|"manages inventory"| node_stock
node_stock -->|"posts inventory"| node_stock_api
node_stock_api -.->|"accesses data"| node_db
node_staff -.->|"records returns"| node_returns
node_staff -.->|"reviews returns"| node_return_history
node_staff -.->|"maintains records"| node_technical
node_staff -.->|"records usage"| node_personal_use
node_personal_use -.->|"submits usage"| node_personal_api
node_personal_api -->|"records usage"| node_db
node_staff -.->|"manages brands"| node_brands
node_staff -.->|"adjusts prices"| node_price_adjust
node_staff -.->|"enters sale"| node_sales
node_sales -.->|"submits sale"| node_sales_api
node_sales_api -->|"records sale"| node_db
node_staff -.->|"reviews sales"| node_sales_history
node_staff -.->|"creates estimates"| node_estimates
node_estimates -.->|"imports spreadsheet"| node_estimate_import
node_estimates -.->|"exports spreadsheet"| node_estimate_export
node_estimates -.->|"generates PDF"| node_estimate_pdf
node_staff -.->|"reviews reports"| node_reports_list
node_staff -.->|"views charts"| node_reports_charts
node_reports_list -.->|"exports reports"| node_reports_export

click node_auth "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/auth/%5B...nextauth%5D/route.js"
click node_profile "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/perfil/route.js"
click node_users "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/UsuariosClient.js"
click node_stock "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/StockClient.js"
click node_stock_api "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/stock/route.js"
click node_returns "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/DevolucionClient.js"
click node_return_history "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VerDevolucionesClient.js"
click node_technical "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/FichaTecnicaClient.js"
click node_personal_use "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/UsoPersonalClient.js"
click node_personal_api "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/uso-personal/route.js"
click node_brands "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/MarcasClient.js"
click node_price_adjust "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/AjustePreciosClient.js"
click node_sales "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VentaClient.js"
click node_sales_api "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/ventas/route.js"
click node_sales_history "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VerVentasClient.js"
click node_estimates "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/PresupuestosClient.js"
click node_estimate_import "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoExcelImport.js"
click node_estimate_export "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoExcel.js"
click node_estimate_pdf "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoPdfDocument.js"
click node_reports_list "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/ReportesListaClient.js"
click node_reports_charts "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/ReportesGraficosClient.js"
click node_reports_export "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/reportesExcel.js"
click node_db "https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/db.js"

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_auth,node_profile,node_users toneBlue
class node_stock,node_stock_api,node_returns,node_return_history,node_technical,node_personal_use,node_personal_api,node_brands,node_price_adjust toneAmber
class node_sales,node_sales_api,node_sales_history,node_estimates,node_estimate_import,node_estimate_export,node_estimate_pdf toneMint
class node_reports_list,node_reports_charts,node_reports_export toneRose
class node_db,node_staff toneIndigo
```

## Components

### Identity and profile

- [Credentials sign-in](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/auth/%5B...nextauth%5D/route.js): `taller/app/api/auth/[...nextauth]/route.js`
- [User profile](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/perfil/route.js): `taller/app/api/perfil/route.js`
- [User administration](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/UsuariosClient.js): `taller/components/UsuariosClient.js`

### Workshop operations

- [Inventory management](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/StockClient.js): `taller/components/StockClient.js`
- [Inventory API](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/stock/route.js): `taller/app/api/stock/route.js`
- [Returns](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/DevolucionClient.js): `taller/components/DevolucionClient.js`
- [Return history](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VerDevolucionesClient.js): `taller/components/VerDevolucionesClient.js`
- [Technical records](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/FichaTecnicaClient.js): `taller/components/FichaTecnicaClient.js`
- [Personal use](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/UsoPersonalClient.js): `taller/components/UsoPersonalClient.js`
- [Personal-use API](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/uso-personal/route.js): `taller/app/api/uso-personal/route.js`
- [Brand catalog](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/MarcasClient.js): `taller/components/MarcasClient.js`
- [Price adjustments](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/AjustePreciosClient.js): `taller/components/AjustePreciosClient.js`

### Sales and estimates

- [Sales entry](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VentaClient.js): `taller/components/VentaClient.js`
- [Sales API](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/app/api/ventas/route.js): `taller/app/api/ventas/route.js`
- [Sales history](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/VerVentasClient.js): `taller/components/VerVentasClient.js`
- [Estimates](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/PresupuestosClient.js): `taller/components/PresupuestosClient.js`
- [Estimate import](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoExcelImport.js): `taller/lib/presupuestoExcelImport.js`
- [Estimate spreadsheet](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoExcel.js): `taller/lib/presupuestoExcel.js`
- [Estimate PDF](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/presupuestoPdfDocument.js): `taller/lib/presupuestoPdfDocument.js`

### Reporting

- [Report listings](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/ReportesListaClient.js): `taller/components/ReportesListaClient.js`
- [Report charts](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/ReportesGraficosClient.js): `taller/components/ReportesGraficosClient.js`
- [Report export](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/lib/reportesExcel.js): `taller/lib/reportesExcel.js`

### Shared runtime

- [Database access](https://github.com/oyarzabalvalentin174-beep/motomecanica/blob/main/taller/components/db.js): `taller/components/db.js`

### Other components

- **Workshop staff**

## Connections

- Workshop staff → Credentials sign-in: signs in (evidence: `taller/app/api/auth/[...nextauth]/route.js`)
- Credentials sign-in → Database access: checks credentials (evidence: `taller/app/api/auth/[...nextauth]/route.js`)
- Workshop staff → User profile: updates profile
- User profile → Credentials sign-in: checks session (evidence: `taller/app/api/perfil/route.js`)
- User profile → Database access: reads and writes (evidence: `taller/app/api/perfil/route.js`)
- Workshop staff → Inventory management: manages inventory
- Inventory management → Inventory API: posts inventory (evidence: `taller/components/StockClient.js`)
- Inventory API → Database access: accesses data
- Workshop staff → Returns: records returns
- Workshop staff → Return history: reviews returns
- Workshop staff → Technical records: maintains records
- Workshop staff → Personal use: records usage
- Personal use → Personal-use API: submits usage
- Personal-use API → Database access: records usage (evidence: `taller/app/api/uso-personal/route.js`)
- Workshop staff → Brand catalog: manages brands
- Workshop staff → Price adjustments: adjusts prices
- Workshop staff → Sales entry: enters sale
- Sales entry → Sales API: submits sale
- Sales API → Database access: records sale (evidence: `taller/app/api/ventas/route.js`)
- Workshop staff → Sales history: reviews sales
- Workshop staff → Estimates: creates estimates
- Estimates → Estimate import: imports spreadsheet
- Estimates → Estimate spreadsheet: exports spreadsheet
- Estimates → Estimate PDF: generates PDF
- Workshop staff → Report listings: reviews reports
- Workshop staff → Report charts: views charts
- Report listings → Report export: exports reports
