# jdcarrillo15/sistema-de-gestion-aroma-y-sabor architecture

> Architecture diagram of the GitHub repository jdcarrillo15/sistema-de-gestion-aroma-y-sabor, 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/jdcarrillo15/sistema-de-gestion-aroma-y-sabor
- Repository: https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor

## Overview

This is a restaurant point-of-sale and operations system: staff sign in, then work through role-oriented screens for tables and orders, kitchen preparation, cashier bills and shifts, while administrators manage products, users, inventory, sales and reporting. The React app routes those experiences; the Express API authenticates and authorizes requests, dispatches domain routes to controllers, and uses Firebase/Firestore with Redis caching. Socket.IO supports realtime updates. Several frontend service-to-API connections and unsampled feature internals are not evidenced in the excerpts, so those links are omitted.

Main entry points: [`backend/src/app.js`](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/app.js) (HTTP and Socket App), [`frontend/src/App.tsx`](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/App.tsx) (Role Routes), [`backend/src/config/firebase.js`](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/firebase.js) (Firestore), [`backend/src/config/redis.js`](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/redis.js) (Redis Cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Staff Web App"]
  node_app["Role Routes<br/>[App.tsx]"]
  node_login["Login<br/>[LoginPage.tsx]"]
  node_admin["Admin Console<br/>[ProductsPage.tsx]"]
  node_turnsui["Shift Management<br/>[TurnosPage.tsx]"]
  node_cashui["Cashier Desk<br/>[CajaPage.tsx]"]
  node_kitchenui["Kitchen Screen<br/>[CocinaPage.tsx]"]
  node_waiterui["Waiter Tables<br/>[MesasPage.tsx]"]
  node_socketctx["Realtime Context<br/>[socketContext.tsx]"]
  node_socketclient["Socket Client<br/>[socket.ts]"]
end

subgraph group_identity["Identity and Access"]
  node_authui["Session Client<br/>[authService.ts]"]
  node_authmw["Session and Policy Checks<br/>[auth.js]"]
  node_policy["Policy Evaluation<br/>[authService.js]"]
end

subgraph group_operations["Restaurant Operations"]
  node_billroute["Bill Routes<br/>[billsRoutes.js]"]
  node_billctl["Bill Operations<br/>[billsController.js]"]
  node_shiftctl["Shift Operations"]
  node_userctl["User Management<br/>[usersController.js]"]
  node_productctl["Product Management"]
  node_tablectl["Table Management"]
  node_reports["Sales Reports"]
  node_shiftsroute["Shift Routes<br/>[shiftsRoutes.js]"]
  node_usersroute["User Routes<br/>[usersRoutes.js]"]
  node_productsroute["Product Routes<br/>[productsRoutes.js]"]
  node_tablesroute["Table Routes<br/>[tableRoutes.js]"]
  node_reportsroute["Report Routes<br/>[reportsRoutes.js]"]
end

subgraph group_platform["Runtime and Data"]
  node_api["HTTP and Socket App<br/>[app.js]"]
  node_firestore[("Firestore<br/>[firebase.js]")]
  node_redis[("Redis Cache<br/>[redis.js]")]
  node_socketserver["Realtime Events<br/>[socket.js]"]
  node_metrics["Metrics<br/>[prometheus.js]"]
end

node_staff(("Staff"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_admin
node_app -->|"routes to"| node_turnsui
node_app -->|"routes to"| node_cashui
node_app -->|"routes to"| node_kitchenui
node_app -->|"routes to"| node_waiterui
node_app -->|"provides"| node_socketctx
node_socketctx -->|"uses"| node_socketclient
node_login -.->|"submits credentials"| node_authui
node_authui -.->|"calls auth API"| node_api
node_api -->|"mounts"| node_billroute
node_api -->|"mounts"| node_shiftsroute
node_api -->|"mounts"| node_usersroute
node_api -->|"mounts"| node_productsroute
node_api -->|"mounts"| node_tablesroute
node_api -->|"mounts"| node_reportsroute
node_api -.->|"installs"| node_authmw
node_billroute -->|"guards requests"| node_authmw
node_billroute -->|"dispatches"| node_billctl
node_shiftsroute -->|"dispatches"| node_shiftctl
node_usersroute -->|"dispatches"| node_userctl
node_productsroute -->|"dispatches"| node_productctl
node_tablesroute -->|"dispatches"| node_tablectl
node_reportsroute -->|"dispatches"| node_reports
node_authmw -->|"checks access"| node_policy
node_authmw -->|"verifies sessions"| node_firestore
node_policy -->|"reads policies"| node_firestore
node_billctl -->|"reads and writes"| node_firestore
node_billctl -->|"caches and invalidates"| node_redis
node_billctl -.->|"emits updates"| node_socketserver
node_shiftctl -->|"reads and writes"| node_firestore
node_shiftctl -->|"invalidates cache"| node_redis
node_shiftctl -->|"emits updates"| node_socketserver
node_userctl -->|"reads and writes"| node_firestore
node_userctl -->|"caches and invalidates"| node_redis
node_productctl -->|"reads and writes"| node_firestore
node_productctl -->|"uses cache"| node_redis
node_tablectl -->|"reads and writes"| node_firestore
node_tablectl -->|"uses cache"| node_redis
node_api -.->|"records requests"| node_metrics

click node_app "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/App.tsx"
click node_login "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/login/LoginPage.tsx"
click node_admin "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/admin/ProductsPage.tsx"
click node_turnsui "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/admin/TurnosPage.tsx"
click node_cashui "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/caja/CajaPage.tsx"
click node_kitchenui "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/cocina/CocinaPage.tsx"
click node_waiterui "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/mesero/MesasPage.tsx"
click node_socketctx "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/context/socketContext.tsx"
click node_socketclient "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/services/sockets/socket.ts"
click node_authui "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/services/login/authService.ts"
click node_authmw "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/middleware/auth.js"
click node_policy "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/services/authService.js"
click node_api "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/app.js"
click node_billroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/billsRoutes.js"
click node_billctl "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/billsController.js"
click node_shiftctl "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/shiftsController.js"
click node_userctl "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/usersController.js"
click node_productctl "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/productsController.js"
click node_tablectl "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/tablesController.js"
click node_reports "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/reportsController.js"
click node_shiftsroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/shiftsRoutes.js"
click node_usersroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/usersRoutes.js"
click node_productsroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/productsRoutes.js"
click node_tablesroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/tableRoutes.js"
click node_reportsroute "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/reportsRoutes.js"
click node_firestore "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/firebase.js"
click node_redis "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/redis.js"
click node_socketserver "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/sockets/socket.js"
click node_metrics "https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/monitoring/prometheus.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_app,node_login,node_admin,node_turnsui,node_cashui,node_kitchenui,node_waiterui,node_socketctx,node_socketclient toneBlue
class node_authui,node_authmw,node_policy toneAmber
class node_billroute,node_billctl,node_shiftctl,node_userctl,node_productctl,node_tablectl,node_reports,node_shiftsroute,node_usersroute,node_productsroute,node_tablesroute,node_reportsroute toneMint
class node_api,node_firestore,node_redis,node_socketserver,node_metrics toneRose
class node_staff toneIndigo
```

## Components

### Staff Web App

- [Role Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/login/LoginPage.tsx): `frontend/src/pages/login/LoginPage.tsx`
- [Admin Console](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/admin/ProductsPage.tsx): `frontend/src/pages/admin/ProductsPage.tsx`
- [Shift Management](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/admin/TurnosPage.tsx): `frontend/src/pages/admin/TurnosPage.tsx`
- [Cashier Desk](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/caja/CajaPage.tsx): `frontend/src/pages/caja/CajaPage.tsx`
- [Kitchen Screen](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/cocina/CocinaPage.tsx): `frontend/src/pages/cocina/CocinaPage.tsx`
- [Waiter Tables](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/pages/mesero/MesasPage.tsx): `frontend/src/pages/mesero/MesasPage.tsx`
- [Realtime Context](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/context/socketContext.tsx): `frontend/src/context/socketContext.tsx`
- [Socket Client](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/services/sockets/socket.ts): `frontend/src/services/sockets/socket.ts`

### Identity and Access

- [Session Client](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/frontend/src/services/login/authService.ts): `frontend/src/services/login/authService.ts`
- [Session and Policy Checks](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Policy Evaluation](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/services/authService.js): `backend/src/services/authService.js`

### Restaurant Operations

- [Bill Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/billsRoutes.js): `backend/src/routes/billsRoutes.js`
- [Bill Operations](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/billsController.js): `backend/src/controllers/billsController.js`
- [Shift Operations](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/shiftsController.js): `backend/src/controllers/shiftsController.js`
- [User Management](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/usersController.js): `backend/src/controllers/usersController.js`
- [Product Management](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/productsController.js): `backend/src/controllers/productsController.js`
- [Table Management](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/tablesController.js): `backend/src/controllers/tablesController.js`
- [Sales Reports](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/controllers/reportsController.js): `backend/src/controllers/reportsController.js`
- [Shift Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/shiftsRoutes.js): `backend/src/routes/shiftsRoutes.js`
- [User Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/usersRoutes.js): `backend/src/routes/usersRoutes.js`
- [Product Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/productsRoutes.js): `backend/src/routes/productsRoutes.js`
- [Table Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/tableRoutes.js): `backend/src/routes/tableRoutes.js`
- [Report Routes](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/routes/reportsRoutes.js): `backend/src/routes/reportsRoutes.js`

### Runtime and Data

- [HTTP and Socket App](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/app.js): `backend/src/app.js`
- [Firestore](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/firebase.js): `backend/src/config/firebase.js`
- [Redis Cache](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/config/redis.js): `backend/src/config/redis.js`
- [Realtime Events](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/sockets/socket.js): `backend/src/sockets/socket.js`
- [Metrics](https://github.com/jdcarrillo15/sistema-de-gestion-aroma-y-sabor/blob/deploy/backend/src/monitoring/prometheus.js): `backend/src/monitoring/prometheus.js`

### Other components

- **Staff**

## Connections

- Staff → Role Routes: uses (evidence: `frontend/src/App.tsx`)
- Role Routes → Login: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Admin Console: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Shift Management: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Cashier Desk: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Kitchen Screen: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Waiter Tables: routes to (evidence: `frontend/src/App.tsx`)
- Role Routes → Realtime Context: provides (evidence: `frontend/src/App.tsx`)
- Realtime Context → Socket Client: uses (evidence: `frontend/src/context/socketContext.tsx`)
- Login → Session Client: submits credentials
- Session Client → HTTP and Socket App: calls auth API
- HTTP and Socket App → Bill Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → Shift Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → User Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → Product Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → Table Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → Report Routes: mounts (evidence: `backend/src/app.js`)
- HTTP and Socket App → Session and Policy Checks: installs
- Bill Routes → Session and Policy Checks: guards requests (evidence: `backend/src/routes/billsRoutes.js`)
- Bill Routes → Bill Operations: dispatches (evidence: `backend/src/routes/billsRoutes.js`)
- Shift Routes → Shift Operations: dispatches (evidence: `backend/src/routes/shiftsRoutes.js`)
- User Routes → User Management: dispatches (evidence: `backend/src/routes/usersRoutes.js`)
- Product Routes → Product Management: dispatches (evidence: `backend/src/routes/productsRoutes.js`)
- Table Routes → Table Management: dispatches (evidence: `backend/src/routes/tableRoutes.js`)
- Report Routes → Sales Reports: dispatches (evidence: `backend/src/routes/reportsRoutes.js`)
- Session and Policy Checks → Policy Evaluation: checks access (evidence: `backend/src/middleware/auth.js`)
- Session and Policy Checks → Firestore: verifies sessions (evidence: `backend/src/middleware/auth.js`)
- Policy Evaluation → Firestore: reads policies (evidence: `backend/src/services/authService.js`)
- Bill Operations → Firestore: reads and writes (evidence: `backend/src/controllers/billsController.js`)
- Bill Operations → Redis Cache: caches and invalidates (evidence: `backend/src/controllers/billsController.js`)
- Bill Operations → Realtime Events: emits updates (evidence: `backend/src/controllers/billsController.js`)
- Shift Operations → Firestore: reads and writes (evidence: `backend/src/controllers/shiftsController.js`)
- Shift Operations → Redis Cache: invalidates cache (evidence: `backend/src/controllers/shiftsController.js`)
- Shift Operations → Realtime Events: emits updates (evidence: `backend/src/controllers/shiftsController.js`)
- User Management → Firestore: reads and writes (evidence: `backend/src/controllers/usersController.js`)
- User Management → Redis Cache: caches and invalidates (evidence: `backend/src/controllers/usersController.js`)
- Product Management → Firestore: reads and writes (evidence: `backend/src/controllers/productsController.js`)
- Product Management → Redis Cache: uses cache (evidence: `backend/src/controllers/productsController.js`)
- Table Management → Firestore: reads and writes (evidence: `backend/src/controllers/tablesController.js`)
- Table Management → Redis Cache: uses cache (evidence: `backend/src/controllers/tablesController.js`)
- HTTP and Socket App → Metrics: records requests
