# andres345f/proyecto-2---feder architecture

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

- Interactive diagram: https://gitdiagram.com/andres345f/proyecto-2---feder
- Repository: https://github.com/andres345f/proyecto-2---feder

## Overview

FEDER Web is a Spanish-language agricultural federation commerce and operations system, with producer-origin traceability. A user enters through the React router, uses role-specific pages and API clients, and receives JSON responses from Laravel services backed by the existing PostgreSQL schema. Distinct workflows include customer catalog/cart/orders/payments, producer applications and production-to-purchase operations, and staff administration and operational reporting. The README documents the controller→service→repository layering; source excerpts confirm producer-operation calls and repository persistence. Most domain modules are indexed but not sampled, so their internal links are shown only where documented.

Main entry points: [`backend/routes/api.php`](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/routes/api.php) (REST route dispatch), [`backend/app/Services/OperacionProductorService.php`](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/OperacionProductorService.php) (Production and purchasing), [`backend/app/Services`](https://github.com/andres345f/proyecto-2---feder/tree/main/backend/app/Services) (Commerce rules), [`frontend/src/routes/AppRouter.jsx`](https://github.com/andres345f/proyecto-2---feder/blob/main/frontend/src/routes/AppRouter.jsx) (Role-based routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Web presentation"]
  node_router["Role-based routes<br/>[AppRouter.jsx]"]
  node_pages["Commerce and ops pages"]
  node_session["Session and preferences"]
  node_http["HTTP client<br/>[clienteHttp.js]"]
end

subgraph group_api["API boundary"]
  node_api_routes["REST route dispatch<br/>[api.php]"]
  node_auth_controller["Authentication endpoints"]
  node_product_controller["Product endpoints"]
  node_producer_controller["Producer operations endpoints"]
  node_producer_profile_controller["Producer affiliation"]
end

subgraph group_commerce["Commerce operations"]
  node_commerce_services["Commerce rules"]
  node_commerce_data["Commerce repositories"]
  node_payments["Payments and plans<br/>[PagoService.php]"]
  node_orders["Orders and delivery<br/>[PedidoService.php]"]
end

subgraph group_producer["Producer operations"]
  node_producer_service["Production and purchasing"]
  node_producer_repository["Producer operation data"]
  node_producer_profile["Producer affiliation rules"]
end

subgraph group_platform["Business platform"]
  node_admin["Administration and permissions"]
  node_insights["Reporting and statistics<br/>[ReporteService.php]"]
  node_audit["Audit trail"]
  node_database[("PostgreSQL")]
  node_operation_record["Operation confirmation records"]
end

node_customer(("Web users"))

node_customer -->|"opens"| node_router
node_router -->|"routes to"| node_pages
node_session -->|"guards routes"| node_router
node_pages -.->|"requests data"| node_http
node_http -->|"sends JSON"| node_api_routes
node_api_routes -->|"dispatches auth"| node_auth_controller
node_api_routes -->|"dispatches product"| node_product_controller
node_api_routes -->|"dispatches operations"| node_producer_controller
node_api_routes -->|"dispatches affiliation"| node_producer_profile_controller
node_auth_controller -.->|"returns session data"| node_session
node_product_controller -->|"delegates rules"| node_commerce_services
node_producer_controller -->|"calls operations"| node_producer_service
node_producer_profile_controller -->|"calls affiliation rules"| node_producer_profile
node_producer_service -->|"reads and updates"| node_producer_repository
node_producer_repository -->|"queries records"| node_operation_record
node_producer_service -->|"runs transactions"| node_database
node_commerce_services -.->|"uses repositories"| node_commerce_data
node_commerce_services -.->|"includes order rules"| node_orders
node_commerce_services -.->|"includes payment rules"| node_payments
node_commerce_data -->|"queries data"| node_database
node_producer_service -->|"uses product rules"| node_commerce_services
node_producer_service -->|"records operations"| node_audit
node_admin -.->|"persists settings"| node_database
node_insights -.->|"reads business data"| node_database

click node_router "https://github.com/andres345f/proyecto-2---feder/blob/main/frontend/src/routes/AppRouter.jsx"
click node_pages "https://github.com/andres345f/proyecto-2---feder/tree/main/frontend/src/pages"
click node_session "https://github.com/andres345f/proyecto-2---feder/tree/main/frontend/src/context"
click node_http "https://github.com/andres345f/proyecto-2---feder/blob/main/frontend/src/api/clienteHttp.js"
click node_api_routes "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/routes/api.php"
click node_auth_controller "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/AutenticacionController.php"
click node_product_controller "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/ProductoController.php"
click node_producer_controller "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/OperacionProductorController.php"
click node_producer_profile_controller "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/ProductorController.php"
click node_commerce_services "https://github.com/andres345f/proyecto-2---feder/tree/main/backend/app/Services"
click node_commerce_data "https://github.com/andres345f/proyecto-2---feder/tree/main/backend/app/Repositories"
click node_producer_service "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/OperacionProductorService.php"
click node_producer_repository "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Repositories/OperacionProductorRepository.php"
click node_producer_profile "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/ProductorService.php"
click node_payments "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/PagoService.php"
click node_orders "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/PedidoService.php"
click node_admin "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/AdminUsuarioService.php"
click node_insights "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/ReporteService.php"
click node_audit "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/AuditoriaService.php"
click node_operation_record "https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Models/ConfirmacionOperacion.php"

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_router,node_pages,node_session,node_http,node_customer toneBlue
class node_api_routes,node_auth_controller,node_product_controller,node_producer_controller,node_producer_profile_controller toneAmber
class node_commerce_services,node_commerce_data,node_payments,node_orders toneMint
class node_producer_service,node_producer_repository,node_producer_profile toneRose
class node_admin,node_insights,node_audit,node_database,node_operation_record toneIndigo
```

## Components

### Web presentation

- [Role-based routes](https://github.com/andres345f/proyecto-2---feder/blob/main/frontend/src/routes/AppRouter.jsx): `frontend/src/routes/AppRouter.jsx`
- [Commerce and ops pages](https://github.com/andres345f/proyecto-2---feder/tree/main/frontend/src/pages): `frontend/src/pages`
- [Session and preferences](https://github.com/andres345f/proyecto-2---feder/tree/main/frontend/src/context): `frontend/src/context`
- [HTTP client](https://github.com/andres345f/proyecto-2---feder/blob/main/frontend/src/api/clienteHttp.js): `frontend/src/api/clienteHttp.js`

### API boundary

- [REST route dispatch](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Authentication endpoints](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/AutenticacionController.php): `backend/app/Http/Controllers/Api/AutenticacionController.php`
- [Product endpoints](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/ProductoController.php): `backend/app/Http/Controllers/Api/ProductoController.php`
- [Producer operations endpoints](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/OperacionProductorController.php): `backend/app/Http/Controllers/Api/OperacionProductorController.php`
- [Producer affiliation](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Http/Controllers/Api/ProductorController.php): `backend/app/Http/Controllers/Api/ProductorController.php`

### Commerce operations

- [Commerce rules](https://github.com/andres345f/proyecto-2---feder/tree/main/backend/app/Services): `backend/app/Services`
- [Commerce repositories](https://github.com/andres345f/proyecto-2---feder/tree/main/backend/app/Repositories): `backend/app/Repositories`
- [Payments and plans](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/PagoService.php): `backend/app/Services/PagoService.php`
- [Orders and delivery](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/PedidoService.php): `backend/app/Services/PedidoService.php`

### Producer operations

- [Production and purchasing](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/OperacionProductorService.php): `backend/app/Services/OperacionProductorService.php`
- [Producer operation data](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Repositories/OperacionProductorRepository.php): `backend/app/Repositories/OperacionProductorRepository.php`
- [Producer affiliation rules](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/ProductorService.php): `backend/app/Services/ProductorService.php`

### Business platform

- [Administration and permissions](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/AdminUsuarioService.php): `backend/app/Services/AdminUsuarioService.php`
- [Reporting and statistics](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/ReporteService.php): `backend/app/Services/ReporteService.php`
- [Audit trail](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Services/AuditoriaService.php): `backend/app/Services/AuditoriaService.php`
- **PostgreSQL**
- [Operation confirmation records](https://github.com/andres345f/proyecto-2---feder/blob/main/backend/app/Models/ConfirmacionOperacion.php): `backend/app/Models/ConfirmacionOperacion.php`

### Other components

- **Web users**

## Connections

- Web users → Role-based routes: opens (evidence: `frontend/src/routes/AppRouter.jsx`)
- Role-based routes → Commerce and ops pages: routes to (evidence: `frontend/src/routes/AppRouter.jsx`)
- Session and preferences → Role-based routes: guards routes (evidence: `frontend/src/App.jsx`)
- Commerce and ops pages → HTTP client: requests data
- HTTP client → REST route dispatch: sends JSON
- REST route dispatch → Authentication endpoints: dispatches auth (evidence: `backend/routes/api.php`)
- REST route dispatch → Product endpoints: dispatches product (evidence: `backend/routes/api.php`)
- REST route dispatch → Producer operations endpoints: dispatches operations (evidence: `backend/routes/api.php`)
- REST route dispatch → Producer affiliation: dispatches affiliation (evidence: `backend/routes/api.php`)
- Authentication endpoints → Session and preferences: returns session data
- Product endpoints → Commerce rules: delegates rules (evidence: `backend/app/Http/Controllers/Api/ProductoController.php`)
- Producer operations endpoints → Production and purchasing: calls operations (evidence: `backend/app/Http/Controllers/Api/OperacionProductorController.php`)
- Producer affiliation → Producer affiliation rules: calls affiliation rules (evidence: `backend/app/Http/Controllers/Api/ProductorController.php`)
- Production and purchasing → Producer operation data: reads and updates (evidence: `backend/app/Services/OperacionProductorService.php`)
- Producer operation data → Operation confirmation records: queries records (evidence: `backend/app/Repositories/OperacionProductorRepository.php`)
- Production and purchasing → PostgreSQL: runs transactions (evidence: `backend/app/Services/OperacionProductorService.php`)
- Commerce rules → Commerce repositories: uses repositories (evidence: `backend/app/Services/OperacionProductorService.php`)
- Commerce rules → Orders and delivery: includes order rules
- Commerce rules → Payments and plans: includes payment rules
- Commerce repositories → PostgreSQL: queries data
- Production and purchasing → Commerce rules: uses product rules (evidence: `backend/app/Services/OperacionProductorService.php`)
- Production and purchasing → Audit trail: records operations (evidence: `backend/app/Services/OperacionProductorService.php`)
- Administration and permissions → PostgreSQL: persists settings
- Reporting and statistics → PostgreSQL: reads business data
