# shbc0/proyecto-final-daw2 architecture

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

- Interactive diagram: https://gitdiagram.com/shbc0/proyecto-final-daw2
- Repository: https://github.com/shbc0/proyecto-final-daw2

## Overview

This is a restaurant operations system: staff authenticate, then manage menu availability and tables, create orders, track kitchen preparation and delivery, close accounts, and review reports; administrators also manage users. The Angular route table documents the role-gated screens. Sampled service code confirms persistence and some cross-service calls, including order-to-menu/table lookups. Many controllers and frontend API services were not sampled, so their runtime connections are omitted rather than inferred.

Main entry points: [`frontend/restaurante-front/src/app/app.routes.ts`](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/app.routes.ts) (Web application), [`backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java`](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java) (Order lifecycle), [`backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java`](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java) (Accounts and closure), [`backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java`](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java) (Table occupancy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Staff application"]
  node_frontend["Web application<br/>[app.routes.ts]"]
  node_login["Sign-in<br/>[login.component.ts]"]
  node_menuui["Menu screens"]
  node_tableui["Table screens<br/>[mesas.component.ts]"]
  node_orderui["Order screens"]
  node_kitchenui["Kitchen screen"]
  node_accountui["Account screen"]
  node_reportui["Report screen"]
  node_userui["User screens"]
end

subgraph group_identity["Identity and access"]
  node_auth["Authentication"]
  node_useradmin["User and role management"]
  node_jwt["JWT security<br/>[JwtService.java]"]
  node_dbusers[("User store")]
end

subgraph group_operations["Restaurant operations"]
  node_menu["Menu and availability<br/>[PlatoService.java]"]
  node_tables["Table occupancy<br/>[MesaService.java]"]
  node_orders["Order lifecycle<br/>[PedidoService.java]"]
  node_accounts["Accounts and closure<br/>[CuentaService.java]"]
  node_reports["Operational reports"]
  node_dbmenu[("Menu store")]
  node_dbtables[("Table store")]
  node_dborders[("Orders and accounts store")]
end

subgraph group_platform["Service platform"]
  node_gateway["API gateway"]
  node_discovery["Service discovery"]
end

node_staff(("Restaurant staff"))

node_staff -.->|"uses"| node_frontend
node_frontend -->|"routes to"| node_login
node_frontend -->|"routes to"| node_menuui
node_frontend -->|"routes to"| node_tableui
node_frontend -->|"routes to"| node_orderui
node_frontend -->|"routes to"| node_kitchenui
node_frontend -->|"routes to"| node_accountui
node_frontend -->|"routes to"| node_reportui
node_frontend -->|"routes to"| node_userui
node_useradmin -->|"reads/writes"| node_dbusers
node_menu -->|"reads/writes"| node_dbmenu
node_tables -->|"reads/writes"| node_dbtables
node_orders -->|"reads/writes"| node_dborders
node_orders -->|"queries table"| node_tables
node_orders -->|"queries menu"| node_menu
node_accounts -->|"reads/writes"| node_dborders
node_accounts -->|"releases table"| node_tables
node_accounts -->|"checks orders"| node_orders
node_reports -->|"reads sales data"| node_dborders

click node_frontend "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/app.routes.ts"
click node_login "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/login/login.component.ts"
click node_menuui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/platos/platos.component.ts"
click node_tableui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/mesas/mesas.component.ts"
click node_orderui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/pedidos/pedidos.component.ts"
click node_kitchenui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/cocina/cocina.component.ts"
click node_accountui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/cuenta/cuenta.component.ts"
click node_reportui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/reportes/reportes.component.ts"
click node_userui "https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/usuarios/usuarios.component.ts"
click node_auth "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/controller/AuthController.java"
click node_useradmin "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/service/UsuarioService.java"
click node_jwt "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/security/JwtService.java"
click node_menu "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/service/PlatoService.java"
click node_tables "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java"
click node_orders "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java"
click node_accounts "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java"
click node_reports "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/ReporteService.java"
click node_dbusers "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/repository/UsuarioRepository.java"
click node_dbmenu "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/repository/PlatoRepository.java"
click node_dbtables "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/repository/MesaRepository.java"
click node_dborders "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/repository/PedidoRepository.java"
click node_gateway "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/restaurante-api-gateway/src/main/java/pe/edu/cibertec/restauranteapigateway/RestauranteApiGatewayApplication.java"
click node_discovery "https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/restaurante-eureka-server/src/main/java/pe/edu/cibertec/restauranteeurekaserver/RestauranteEurekaServerApplication.java"

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_frontend,node_login,node_menuui,node_tableui,node_orderui,node_kitchenui,node_accountui,node_reportui,node_userui toneBlue
class node_auth,node_useradmin,node_jwt,node_dbusers toneAmber
class node_menu,node_tables,node_orders,node_accounts,node_reports,node_dbmenu,node_dbtables,node_dborders toneMint
class node_gateway,node_discovery toneRose
class node_staff toneIndigo
```

## Components

### Staff application

- [Web application](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/app.routes.ts): `frontend/restaurante-front/src/app/app.routes.ts`
- [Sign-in](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/login/login.component.ts): `frontend/restaurante-front/src/app/pages/login/login.component.ts`
- [Menu screens](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/platos/platos.component.ts): `frontend/restaurante-front/src/app/pages/platos/platos.component.ts`
- [Table screens](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/mesas/mesas.component.ts): `frontend/restaurante-front/src/app/pages/mesas/mesas.component.ts`
- [Order screens](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/pedidos/pedidos.component.ts): `frontend/restaurante-front/src/app/pages/pedidos/pedidos.component.ts`
- [Kitchen screen](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/cocina/cocina.component.ts): `frontend/restaurante-front/src/app/pages/cocina/cocina.component.ts`
- [Account screen](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/cuenta/cuenta.component.ts): `frontend/restaurante-front/src/app/pages/cuenta/cuenta.component.ts`
- [Report screen](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/reportes/reportes.component.ts): `frontend/restaurante-front/src/app/pages/reportes/reportes.component.ts`
- [User screens](https://github.com/shbc0/proyecto-final-daw2/blob/main/frontend/restaurante-front/src/app/pages/usuarios/usuarios.component.ts): `frontend/restaurante-front/src/app/pages/usuarios/usuarios.component.ts`

### Identity and access

- [Authentication](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/controller/AuthController.java): `backend/auth-service/src/main/java/pe/edu/cibertec/authservice/controller/AuthController.java`
- [User and role management](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/service/UsuarioService.java): `backend/auth-service/src/main/java/pe/edu/cibertec/authservice/service/UsuarioService.java`
- [JWT security](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/security/JwtService.java): `backend/auth-service/src/main/java/pe/edu/cibertec/authservice/security/JwtService.java`
- [User store](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/auth-service/src/main/java/pe/edu/cibertec/authservice/repository/UsuarioRepository.java): `backend/auth-service/src/main/java/pe/edu/cibertec/authservice/repository/UsuarioRepository.java`

### Restaurant operations

- [Menu and availability](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/service/PlatoService.java): `backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/service/PlatoService.java`
- [Table occupancy](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java): `backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java`
- [Order lifecycle](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java): `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java`
- [Accounts and closure](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java): `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java`
- [Operational reports](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/ReporteService.java): `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/ReporteService.java`
- [Menu store](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/repository/PlatoRepository.java): `backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/repository/PlatoRepository.java`
- [Table store](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/repository/MesaRepository.java): `backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/repository/MesaRepository.java`
- [Orders and accounts store](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/repository/PedidoRepository.java): `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/repository/PedidoRepository.java`

### Service platform

- [API gateway](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/restaurante-api-gateway/src/main/java/pe/edu/cibertec/restauranteapigateway/RestauranteApiGatewayApplication.java): `backend/restaurante-api-gateway/src/main/java/pe/edu/cibertec/restauranteapigateway/RestauranteApiGatewayApplication.java`
- [Service discovery](https://github.com/shbc0/proyecto-final-daw2/blob/main/backend/restaurante-eureka-server/src/main/java/pe/edu/cibertec/restauranteeurekaserver/RestauranteEurekaServerApplication.java): `backend/restaurante-eureka-server/src/main/java/pe/edu/cibertec/restauranteeurekaserver/RestauranteEurekaServerApplication.java`

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → Web application: uses
- Web application → Sign-in: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Menu screens: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Table screens: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Order screens: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Kitchen screen: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Account screen: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → Report screen: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- Web application → User screens: routes to (evidence: `frontend/restaurante-front/src/app/app.routes.ts`)
- User and role management → User store: reads/writes (evidence: `backend/auth-service/src/main/java/pe/edu/cibertec/authservice/service/UsuarioService.java`)
- Menu and availability → Menu store: reads/writes (evidence: `backend/carta-service/src/main/java/pe/edu/cibertec/cartaservice/service/PlatoService.java`)
- Table occupancy → Table store: reads/writes (evidence: `backend/mesa-service/src/main/java/pe/edu/cibertec/mesaservice/service/MesaService.java`)
- Order lifecycle → Orders and accounts store: reads/writes (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java`)
- Order lifecycle → Table occupancy: queries table (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java`)
- Order lifecycle → Menu and availability: queries menu (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/PedidoService.java`)
- Accounts and closure → Orders and accounts store: reads/writes (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java`)
- Accounts and closure → Table occupancy: releases table (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java`)
- Accounts and closure → Order lifecycle: checks orders (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/CuentaService.java`)
- Operational reports → Orders and accounts store: reads sales data (evidence: `backend/pedido-service/src/main/java/pe/edu/cibertec/pedidoservice/service/ReporteService.java`)
