# oswincuaran/proyect_isw2_ferreteria_cafetera_microservices architecture

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

- Interactive diagram: https://gitdiagram.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices
- Repository: https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices

## Overview

Ferretería Cafetera’s inventory system is a set of REST microservices behind a Laravel API Gateway. The documented user flow is request → gateway authentication/role checks and routing → the relevant service; purchases can also validate suppliers and warehouses and register inventory movements. Core domain branches cover inventory, catalog, suppliers, purchasing and returns, alerts, and reporting. Edges between services follow README documentation; internal edges use the shown excerpts or source-index references. Some service internals and route wiring were not sampled, so those links are limited to documented relationships.

Main entry points: [`gateway/app/Http/Controllers/ProxyController.php`](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Http/Controllers/ProxyController.php) (API gateway), [`compras/clients.py`](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/clients.py) (Service clients), [`compras/orders.py`](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/orders.py) (Purchases service), [`catalogo/routes/products.js`](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/routes/products.js) (Products)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["Gateway and identity"]
  node_gateway_api["API gateway"]
  node_auth_users["User management<br/>[UserController.php]"]
  node_auth_models[("Users and roles<br/>[User.php]")]
  node_gateway_middleware["Request security<br/>[app.php]"]
end

subgraph group_inventory["Inventory"]
  node_inventory_api["Inventory service<br/>[views.py]"]
  node_inventory_domain["Stock and movements<br/>[services.py]"]
  node_inventory_models[("Inventory records<br/>[models.py]")]
end

subgraph group_commerce["Purchases and returns"]
  node_purchases_api["Purchases service<br/>[orders.py]"]
  node_returns["Returns service<br/>[returns.py]"]
  node_purchase_clients["Service clients<br/>[clients.py]"]
  node_purchase_db[("Purchases database<br/>[database.py]")]
end

subgraph group_catalog_suppliers["Catalog and suppliers"]
  node_catalog_categories["Categories<br/>[categories.js]"]
  node_catalog_products["Products<br/>[products.js]"]
  node_catalog_db[("Catalog database<br/>[db.js]")]
  node_supplier_api["Supplier service<br/>[views.py]"]
  node_supplier_client["Supplier lookup<br/>[suppliers.js]"]
end

subgraph group_insights["Alerts and reporting"]
  node_alerts["Alerts service<br/>[alerts.js]"]
  node_reports["Reports and dashboard<br/>[reports.py]"]
  node_report_clients["Report clients<br/>[clients.py]"]
  node_mail["Email delivery<br/>[mailer.js]"]
end

node_user(("Staff user"))

node_user -->|"sends request"| node_gateway_api
node_gateway_api -->|"applies checks"| node_gateway_middleware
node_gateway_api -.->|"routes identity"| node_auth_users
node_auth_users -->|"reads and writes"| node_auth_models
node_gateway_api -->|"routes requests"| node_inventory_api
node_gateway_api -->|"routes requests"| node_supplier_api
node_gateway_api -->|"routes requests"| node_catalog_categories
node_gateway_api -->|"routes requests"| node_catalog_products
node_gateway_api -->|"routes requests"| node_purchases_api
node_gateway_api -->|"routes requests"| node_alerts
node_gateway_api -->|"routes requests"| node_reports
node_inventory_api -.->|"delegates stock logic"| node_inventory_domain
node_inventory_domain -->|"uses records"| node_inventory_models
node_purchases_api -->|"validates and registers"| node_purchase_clients
node_returns -->|"calls service clients"| node_purchase_clients
node_purchases_api -->|"uses database"| node_purchase_db
node_returns -->|"uses database"| node_purchase_db
node_purchase_clients -->|"checks and posts movements"| node_inventory_api
node_purchase_clients -->|"checks supplier"| node_supplier_api
node_catalog_categories -->|"queries"| node_catalog_db
node_catalog_products -->|"queries"| node_catalog_db
node_catalog_products -->|"checks supplier"| node_supplier_client
node_supplier_client -.->|"requests supplier data"| node_supplier_api
node_alerts -->|"sends notifications"| node_mail
node_alerts -.->|"looks up user data"| node_gateway_api
node_reports -.->|"uses service clients"| node_report_clients

click node_gateway_api "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Http/Controllers/ProxyController.php"
click node_auth_users "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Http/Controllers/UserController.php"
click node_auth_models "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Models/User.php"
click node_gateway_middleware "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/bootstrap/app.php"
click node_inventory_api "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/views.py"
click node_inventory_domain "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/services.py"
click node_inventory_models "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/models.py"
click node_purchases_api "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/orders.py"
click node_returns "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/returns.py"
click node_purchase_clients "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/clients.py"
click node_purchase_db "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/database.py"
click node_catalog_categories "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/routes/categories.js"
click node_catalog_products "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/routes/products.js"
click node_catalog_db "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/db.js"
click node_supplier_api "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/proveedores/suppliers/views.py"
click node_supplier_client "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/clients/suppliers.js"
click node_alerts "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/notificaciones/routes/alerts.js"
click node_reports "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/reportes/reports.py"
click node_report_clients "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/reportes/clients.py"
click node_mail "https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/notificaciones/utils/mailer.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_gateway_api,node_auth_users,node_auth_models,node_gateway_middleware,node_user toneBlue
class node_inventory_api,node_inventory_domain,node_inventory_models toneAmber
class node_purchases_api,node_returns,node_purchase_clients,node_purchase_db toneMint
class node_catalog_categories,node_catalog_products,node_catalog_db,node_supplier_api,node_supplier_client toneRose
class node_alerts,node_reports,node_report_clients,node_mail toneIndigo
```

## Components

### Gateway and identity

- [API gateway](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Http/Controllers/ProxyController.php): `gateway/app/Http/Controllers/ProxyController.php`
- [User management](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Http/Controllers/UserController.php): `gateway/app/Http/Controllers/UserController.php`
- [Users and roles](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/app/Models/User.php): `gateway/app/Models/User.php`
- [Request security](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/gateway/bootstrap/app.php): `gateway/bootstrap/app.php`

### Inventory

- [Inventory service](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/views.py): `inventario/inventory/views.py`
- [Stock and movements](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/services.py): `inventario/inventory/services.py`
- [Inventory records](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/inventario/inventory/models.py): `inventario/inventory/models.py`

### Purchases and returns

- [Purchases service](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/orders.py): `compras/orders.py`
- [Returns service](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/returns.py): `compras/returns.py`
- [Service clients](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/clients.py): `compras/clients.py`
- [Purchases database](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/compras/database.py): `compras/database.py`

### Catalog and suppliers

- [Categories](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/routes/categories.js): `catalogo/routes/categories.js`
- [Products](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/routes/products.js): `catalogo/routes/products.js`
- [Catalog database](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/db.js): `catalogo/db.js`
- [Supplier service](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/proveedores/suppliers/views.py): `proveedores/suppliers/views.py`
- [Supplier lookup](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/catalogo/clients/suppliers.js): `catalogo/clients/suppliers.js`

### Alerts and reporting

- [Alerts service](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/notificaciones/routes/alerts.js): `notificaciones/routes/alerts.js`
- [Reports and dashboard](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/reportes/reports.py): `reportes/reports.py`
- [Report clients](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/reportes/clients.py): `reportes/clients.py`
- [Email delivery](https://github.com/oswincuaran/proyect_isw2_ferreteria_cafetera_microservices/blob/main/notificaciones/utils/mailer.js): `notificaciones/utils/mailer.js`

### Other components

- **Staff user**

## Connections

- Staff user → API gateway: sends request (evidence: `README.md`)
- API gateway → Request security: applies checks (evidence: `gateway/bootstrap/app.php`)
- API gateway → User management: routes identity
- User management → Users and roles: reads and writes (evidence: `gateway/app/Http/Controllers/UserController.php`)
- API gateway → Inventory service: routes requests (evidence: `README.md`)
- API gateway → Supplier service: routes requests (evidence: `README.md`)
- API gateway → Categories: routes requests (evidence: `README.md`)
- API gateway → Products: routes requests (evidence: `README.md`)
- API gateway → Purchases service: routes requests (evidence: `README.md`)
- API gateway → Alerts service: routes requests (evidence: `README.md`)
- API gateway → Reports and dashboard: routes requests (evidence: `README.md`)
- Inventory service → Stock and movements: delegates stock logic
- Stock and movements → Inventory records: uses records (evidence: `inventario/inventory/services.py`)
- Purchases service → Service clients: validates and registers (evidence: `compras/orders.py`)
- Returns service → Service clients: calls service clients (evidence: `compras/returns.py`)
- Purchases service → Purchases database: uses database (evidence: `compras/orders.py`)
- Returns service → Purchases database: uses database (evidence: `compras/returns.py`)
- Service clients → Inventory service: checks and posts movements (evidence: `compras/clients.py`)
- Service clients → Supplier service: checks supplier (evidence: `compras/clients.py`)
- Categories → Catalog database: queries (evidence: `catalogo/routes/categories.js`)
- Products → Catalog database: queries (evidence: `catalogo/routes/products.js`)
- Products → Supplier lookup: checks supplier (evidence: `catalogo/routes/products.js`)
- Supplier lookup → Supplier service: requests supplier data
- Alerts service → Email delivery: sends notifications (evidence: `notificaciones/routes/alerts.js`)
- Alerts service → API gateway: looks up user data
- Reports and dashboard → Report clients: uses service clients
