# analuciahm27/admproyectos architecture

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

- Interactive diagram: https://gitdiagram.com/analuciahm27/admproyectos
- Repository: https://github.com/analuciahm27/admproyectos

## Overview

Eléctricos Generales is an internal sales and fulfillment system. Its main workflow runs from role-based sign-in and product selection through order creation, voucher upload/OCR, accounting review, warehouse dispatch, and stock updates. The graph separates these domain stages from the shared API, persistence, and real-time notification layer. Some frontend-to-API and stock-update details are documented only at a high level; those links cite the README rather than implying unshown implementation details.

Main entry points: [`frontend/src/App.jsx`](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/App.jsx) (Routes and access), [`backend/src/index.js`](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/index.js) (Express and Socket.IO), [`backend/src/routes/pedidos.js`](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/pedidos.js) (Order API), [`backend/src/routes/vouchers.js`](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/vouchers.js) (Voucher OCR and review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Routes and access<br/>[App.jsx]"]
  node_layout["Role navigation<br/>[Layout.jsx]"]
  node_authui["Session context<br/>[AuthContext.jsx]"]
  node_socketui["Live event client<br/>[SocketContext.jsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.jsx]"]
  node_login["Login<br/>[LoginPage.jsx]"]
end

subgraph group_sales["Sales and catalog"]
  node_catalog["Product catalog<br/>[CatalogoPage.jsx]"]
  node_orderslist["Order list<br/>[PedidosPage.jsx]"]
  node_neworder["Order creation"]
  node_orderdetail["Order detail and upload"]
  node_productsapi["Product API<br/>[productos.js]"]
  node_ordersapi["Order API<br/>[pedidos.js]"]
end

subgraph group_payments["Voucher review"]
  node_voucherapi["Voucher OCR and review<br/>[vouchers.js]"]
  node_accounting["Accounting review"]
end

subgraph group_fulfillment["Warehouse dispatch"]
  node_warehouse["Warehouse dispatch<br/>[AlmacenPage.jsx]"]
  node_warehouseapi["Dispatch and stock API<br/>[almacen.js]"]
end

subgraph group_platform["API and shared services"]
  node_authapi["Authentication API<br/>[auth.js]"]
  node_guard["JWT and role guard<br/>[auth.js]"]
  node_server["Express and Socket.IO<br/>[index.js]"]
  node_notifications["Notification API<br/>[notificaciones.js]"]
  node_database[("Application database<br/>[schema.prisma]")]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_app
node_app -->|"provides session"| node_authui
node_app -->|"provides live events"| node_socketui
node_app -->|"routes to"| node_login
node_app -->|"renders protected"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_orderslist
node_app -->|"routes to"| node_neworder
node_app -->|"routes to"| node_orderdetail
node_app -->|"routes to"| node_accounting
node_app -->|"routes to"| node_warehouse
node_login -->|"signs in through"| node_authui
node_authui -->|"requests session"| node_authapi
node_layout -->|"reads session"| node_authui
node_catalog -.->|"loads catalog"| node_productsapi
node_neworder -.->|"creates order"| node_ordersapi
node_orderslist -.->|"lists orders"| node_ordersapi
node_orderdetail -->|"loads order"| node_ordersapi
node_orderdetail -->|"uploads voucher"| node_voucherapi
node_accounting -.->|"reviews voucher"| node_voucherapi
node_warehouse -.->|"confirms dispatch"| node_warehouseapi
node_server -->|"mounts route"| node_authapi
node_server -->|"mounts route"| node_productsapi
node_server -->|"mounts route"| node_ordersapi
node_server -->|"mounts route"| node_voucherapi
node_server -->|"mounts route"| node_warehouseapi
node_server -->|"mounts route"| node_notifications
node_authapi -->|"protects profile"| node_guard
node_ordersapi -->|"checks access"| node_guard
node_voucherapi -->|"checks access"| node_guard
node_authapi -->|"reads users"| node_database
node_ordersapi -->|"reads and writes"| node_database
node_voucherapi -->|"stores review data"| node_database
node_warehouseapi -.->|"updates stock"| node_database
node_ordersapi -->|"emits order events"| node_server
node_voucherapi -->|"emits review events"| node_server
node_server -.->|"delivers live events"| node_socketui
node_socketui -->|"reads user token"| node_authui
node_accounting -->|"uses live updates"| node_socketui
node_warehouse -->|"uses live updates"| node_socketui

click node_app "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/App.jsx"
click node_layout "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/components/Layout.jsx"
click node_authui "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/context/AuthContext.jsx"
click node_socketui "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/context/SocketContext.jsx"
click node_dashboard "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/DashboardPage.jsx"
click node_login "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/LoginPage.jsx"
click node_catalog "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/CatalogoPage.jsx"
click node_orderslist "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/PedidosPage.jsx"
click node_neworder "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/NuevoPedidoPage.jsx"
click node_orderdetail "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/PedidoDetallePage.jsx"
click node_productsapi "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/productos.js"
click node_ordersapi "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/pedidos.js"
click node_voucherapi "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/vouchers.js"
click node_accounting "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/ContabilidadPage.jsx"
click node_warehouse "https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/AlmacenPage.jsx"
click node_warehouseapi "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/almacen.js"
click node_authapi "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/auth.js"
click node_guard "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/middleware/auth.js"
click node_server "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/index.js"
click node_notifications "https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/notificaciones.js"
click node_database "https://github.com/analuciahm27/admproyectos/blob/main/backend/prisma/schema.prisma"

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_app,node_layout,node_authui,node_socketui,node_dashboard,node_login,node_staff toneBlue
class node_catalog,node_orderslist,node_neworder,node_orderdetail,node_productsapi,node_ordersapi toneAmber
class node_voucherapi,node_accounting toneMint
class node_warehouse,node_warehouseapi toneRose
class node_authapi,node_guard,node_server,node_notifications,node_database toneIndigo
```

## Components

### Web application

- [Routes and access](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role navigation](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/components/Layout.jsx): `frontend/src/components/Layout.jsx`
- [Session context](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Live event client](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/context/SocketContext.jsx): `frontend/src/context/SocketContext.jsx`
- [Dashboard](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/DashboardPage.jsx): `frontend/src/pages/DashboardPage.jsx`
- [Login](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`

### Sales and catalog

- [Product catalog](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/CatalogoPage.jsx): `frontend/src/pages/CatalogoPage.jsx`
- [Order list](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/PedidosPage.jsx): `frontend/src/pages/PedidosPage.jsx`
- [Order creation](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/NuevoPedidoPage.jsx): `frontend/src/pages/NuevoPedidoPage.jsx`
- [Order detail and upload](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/PedidoDetallePage.jsx): `frontend/src/pages/PedidoDetallePage.jsx`
- [Product API](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/productos.js): `backend/src/routes/productos.js`
- [Order API](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/pedidos.js): `backend/src/routes/pedidos.js`

### Voucher review

- [Voucher OCR and review](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/vouchers.js): `backend/src/routes/vouchers.js`
- [Accounting review](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/ContabilidadPage.jsx): `frontend/src/pages/ContabilidadPage.jsx`

### Warehouse dispatch

- [Warehouse dispatch](https://github.com/analuciahm27/admproyectos/blob/main/frontend/src/pages/AlmacenPage.jsx): `frontend/src/pages/AlmacenPage.jsx`
- [Dispatch and stock API](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/almacen.js): `backend/src/routes/almacen.js`

### API and shared services

- [Authentication API](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [JWT and role guard](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Express and Socket.IO](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/index.js): `backend/src/index.js`
- [Notification API](https://github.com/analuciahm27/admproyectos/blob/main/backend/src/routes/notificaciones.js): `backend/src/routes/notificaciones.js`
- [Application database](https://github.com/analuciahm27/admproyectos/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Staff user**

## Connections

- Staff user → Routes and access: uses (evidence: `frontend/src/App.jsx`)
- Routes and access → Session context: provides session (evidence: `frontend/src/App.jsx`)
- Routes and access → Live event client: provides live events (evidence: `frontend/src/App.jsx`)
- Routes and access → Login: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Role navigation: renders protected (evidence: `frontend/src/App.jsx`)
- Routes and access → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Product catalog: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Order list: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Order creation: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Order detail and upload: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Accounting review: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Warehouse dispatch: routes to (evidence: `frontend/src/App.jsx`)
- Login → Session context: signs in through (evidence: `frontend/src/pages/LoginPage.jsx`)
- Session context → Authentication API: requests session (evidence: `frontend/src/context/AuthContext.jsx`)
- Role navigation → Session context: reads session (evidence: `frontend/src/components/Layout.jsx`)
- Product catalog → Product API: loads catalog (evidence: `README.md`)
- Order creation → Order API: creates order (evidence: `README.md`)
- Order list → Order API: lists orders (evidence: `README.md`)
- Order detail and upload → Order API: loads order (evidence: `frontend/src/pages/PedidoDetallePage.jsx`)
- Order detail and upload → Voucher OCR and review: uploads voucher (evidence: `frontend/src/pages/PedidoDetallePage.jsx`)
- Accounting review → Voucher OCR and review: reviews voucher (evidence: `README.md`)
- Warehouse dispatch → Dispatch and stock API: confirms dispatch (evidence: `README.md`)
- Express and Socket.IO → Authentication API: mounts route (evidence: `backend/src/index.js`)
- Express and Socket.IO → Product API: mounts route (evidence: `backend/src/index.js`)
- Express and Socket.IO → Order API: mounts route (evidence: `backend/src/index.js`)
- Express and Socket.IO → Voucher OCR and review: mounts route (evidence: `backend/src/index.js`)
- Express and Socket.IO → Dispatch and stock API: mounts route (evidence: `backend/src/index.js`)
- Express and Socket.IO → Notification API: mounts route (evidence: `backend/src/index.js`)
- Authentication API → JWT and role guard: protects profile (evidence: `backend/src/routes/auth.js`)
- Order API → JWT and role guard: checks access (evidence: `backend/src/routes/pedidos.js`)
- Voucher OCR and review → JWT and role guard: checks access (evidence: `backend/src/routes/vouchers.js`)
- Authentication API → Application database: reads users (evidence: `backend/src/routes/auth.js`)
- Order API → Application database: reads and writes (evidence: `backend/src/routes/pedidos.js`)
- Voucher OCR and review → Application database: stores review data (evidence: `backend/src/routes/vouchers.js`)
- Dispatch and stock API → Application database: updates stock (evidence: `README.md`)
- Order API → Express and Socket.IO: emits order events (evidence: `backend/src/routes/pedidos.js`)
- Voucher OCR and review → Express and Socket.IO: emits review events (evidence: `backend/src/routes/vouchers.js`)
- Express and Socket.IO → Live event client: delivers live events (evidence: `README.md`)
- Live event client → Session context: reads user token (evidence: `frontend/src/context/SocketContext.jsx`)
- Accounting review → Live event client: uses live updates (evidence: `frontend/src/pages/ContabilidadPage.jsx`)
- Warehouse dispatch → Live event client: uses live updates (evidence: `frontend/src/pages/AlmacenPage.jsx`)
