# santidev11/backendentregadeproductos architecture

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

- Interactive diagram: https://gitdiagram.com/santidev11/backendentregadeproductos
- Repository: https://github.com/santidev11/backendentregadeproductos

## Overview

BackendEntregadeProductos is a FastAPI API for product delivery with simulated electronic invoicing. Its principal workflow runs from role-based login through warehouse and catalog setup, invoice creation and delivery, customer signature-based acceptance or rejection, and receipt confirmation; invoices can also be downloaded as PDFs. Separate capabilities cover company registration and approval, user/role/permission administration, customer lookup, and statistics. The README documents the domain flow; source excerpts show selected routing, authorization, scope, and persistence details, so unsampled service links are not asserted.

Main entry points: [`app/config/main.py`](https://github.com/santidev11/backendentregadeproductos/blob/main/app/config/main.py) (REST API), [`app/modulos/facturas/services.py`](https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/services.py) (Invoice workflow), [`app/modulos/empresas`](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/empresas) (Company management), [`app/modulos/tipos`](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/tipos) (Product types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and security"]
  node_api["REST API<br/>[main.py]"]
  node_auth["Authentication"]
  node_security["Token and permissions<br/>[deps.py]"]
  node_mysql[("MySQL database<br/>[database.py]")]
end

subgraph group_org["Organizations and access"]
  node_registration["Registration"]
  node_companies["Company management"]
  node_users["User management"]
  node_roles["Roles and permissions"]
  node_permission_catalog["Permission catalog"]
end

subgraph group_catalog["Delivery setup"]
  node_warehouses["Warehouses"]
  node_types["Product types"]
  node_customers["Customer lookup"]
end

subgraph group_invoice["Invoice lifecycle"]
  node_invoices["Invoice workflow<br/>[services.py]"]
  node_issuer["Invoice issuer<br/>[emisor.py]"]
  node_pdf["Invoice PDF<br/>[pdf.py]"]
end

subgraph group_insight["Reporting"]
  node_statistics["Statistics"]
end

node_client(("Frontend client"))

node_client -->|"calls"| node_api
node_api -->|"registers routes"| node_auth
node_api -->|"registers routes"| node_registration
node_api -->|"registers routes"| node_companies
node_api -->|"registers routes"| node_warehouses
node_api -->|"registers routes"| node_types
node_api -->|"registers routes"| node_customers
node_api -->|"registers routes"| node_invoices
node_api -->|"registers routes"| node_users
node_api -->|"registers routes"| node_roles
node_api -->|"registers routes"| node_permission_catalog
node_api -->|"registers routes"| node_statistics
node_auth -->|"authenticates"| node_security
node_security -->|"loads user"| node_mysql
node_registration -->|"creates company"| node_companies
node_companies -->|"creates account"| node_users
node_warehouses -->|"sets catalog"| node_types
node_types -->|"used in invoice"| node_invoices
node_customers -->|"selects recipient"| node_invoices
node_invoices -->|"uses issuer data"| node_issuer
node_invoices -->|"generates PDF"| node_pdf
node_invoices -->|"persists invoices"| node_mysql
node_statistics -->|"queries data"| node_mysql

click node_api "https://github.com/santidev11/backendentregadeproductos/blob/main/app/config/main.py"
click node_auth "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/auth"
click node_security "https://github.com/santidev11/backendentregadeproductos/blob/main/app/core/deps.py"
click node_mysql "https://github.com/santidev11/backendentregadeproductos/blob/main/app/config/database.py"
click node_registration "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/registro"
click node_companies "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/empresas"
click node_users "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/usuarios"
click node_roles "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/roles"
click node_permission_catalog "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/permisos"
click node_warehouses "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/bodegas"
click node_types "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/tipos"
click node_customers "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/clientes"
click node_invoices "https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/services.py"
click node_issuer "https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/emisor.py"
click node_pdf "https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/pdf.py"
click node_statistics "https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/estadisticas"

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_api,node_auth,node_security,node_mysql,node_client toneBlue
class node_registration,node_companies,node_users,node_roles,node_permission_catalog toneAmber
class node_warehouses,node_types,node_customers toneMint
class node_invoices,node_issuer,node_pdf toneRose
class node_statistics toneIndigo
```

## Components

### API and security

- [REST API](https://github.com/santidev11/backendentregadeproductos/blob/main/app/config/main.py): `app/config/main.py`
- [Authentication](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/auth): `app/modulos/auth`
- [Token and permissions](https://github.com/santidev11/backendentregadeproductos/blob/main/app/core/deps.py): `app/core/deps.py`
- [MySQL database](https://github.com/santidev11/backendentregadeproductos/blob/main/app/config/database.py): `app/config/database.py`

### Organizations and access

- [Registration](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/registro): `app/modulos/registro`
- [Company management](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/empresas): `app/modulos/empresas`
- [User management](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/usuarios): `app/modulos/usuarios`
- [Roles and permissions](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/roles): `app/modulos/roles`
- [Permission catalog](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/permisos): `app/modulos/permisos`

### Delivery setup

- [Warehouses](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/bodegas): `app/modulos/bodegas`
- [Product types](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/tipos): `app/modulos/tipos`
- [Customer lookup](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/clientes): `app/modulos/clientes`

### Invoice lifecycle

- [Invoice workflow](https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/services.py): `app/modulos/facturas/services.py`
- [Invoice issuer](https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/emisor.py): `app/modulos/facturas/emisor.py`
- [Invoice PDF](https://github.com/santidev11/backendentregadeproductos/blob/main/app/modulos/facturas/pdf.py): `app/modulos/facturas/pdf.py`

### Reporting

- [Statistics](https://github.com/santidev11/backendentregadeproductos/tree/main/app/modulos/estadisticas): `app/modulos/estadisticas`

### Other components

- **Frontend client**

## Connections

- Frontend client → REST API: calls (evidence: `README.md`)
- REST API → Authentication: registers routes (evidence: `app/config/main.py`)
- REST API → Registration: registers routes (evidence: `app/config/main.py`)
- REST API → Company management: registers routes (evidence: `app/config/main.py`)
- REST API → Warehouses: registers routes (evidence: `app/config/main.py`)
- REST API → Product types: registers routes (evidence: `app/config/main.py`)
- REST API → Customer lookup: registers routes (evidence: `app/config/main.py`)
- REST API → Invoice workflow: registers routes (evidence: `app/config/main.py`)
- REST API → User management: registers routes (evidence: `app/config/main.py`)
- REST API → Roles and permissions: registers routes (evidence: `app/config/main.py`)
- REST API → Permission catalog: registers routes (evidence: `app/config/main.py`)
- REST API → Statistics: registers routes (evidence: `app/config/main.py`)
- Authentication → Token and permissions: authenticates (evidence: `app/modulos/auth/router.py`)
- Token and permissions → MySQL database: loads user (evidence: `app/core/deps.py`)
- Registration → Company management: creates company (evidence: `README.md`)
- Company management → User management: creates account (evidence: `README.md`)
- Warehouses → Product types: sets catalog (evidence: `README.md`)
- Product types → Invoice workflow: used in invoice (evidence: `README.md`)
- Customer lookup → Invoice workflow: selects recipient (evidence: `README.md`)
- Invoice workflow → Invoice issuer: uses issuer data (evidence: `app/modulos/facturas/services.py`)
- Invoice workflow → Invoice PDF: generates PDF (evidence: `app/modulos/facturas/services.py`)
- Invoice workflow → MySQL database: persists invoices (evidence: `README.md`)
- Statistics → MySQL database: queries data (evidence: `README.md`)
