# juniorfai/sistemarestaurantev2 architecture

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

- Interactive diagram: https://gitdiagram.com/juniorfai/sistemarestaurantev2
- Repository: https://github.com/juniorfai/sistemarestaurantev2

## Overview

Restaurante Master is a multi-restaurant reservation and table-service system: staff use an Angular SPA to manage reservations, guests, tables and menus, then open table accounts and route orders through preparation to payment. The ASP.NET API separates controllers, business services and data access; the shared SQL Server store enforces tenant isolation and key concurrency constraints. The README documents the broader capabilities, while sampled source confirms selected reservation, ordering and persistence behavior; unsampled feature-level wiring is not asserted.

Main entry points: [`SistemaRestaurante-Front/src/app/app.ts`](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/app.ts) (Angular application), [`SistemaRestaurante.API/Program.cs`](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Program.cs) (REST API), [`SistemaRestaurante.Domain/Services/OrderService.cs`](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.Domain/Services/OrderService.cs) (Order workflow), [`SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs`](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs) (SQL Server data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Staff interface"]
  node_spa["Angular application<br/>[app.ts]"]
  node_reservation_ui["Reservation screens"]
  node_service_ui["Table-service screens"]
  node_auth_ui["Login and account<br/>[login.ts]"]
end

subgraph group_api["API and domain"]
  node_api["REST API<br/>[Program.cs]"]
  node_reservation_api["Reservation endpoints"]
  node_order_api["Order endpoints<br/>[OrderController.cs]"]
  node_kitchen_api["Kitchen screens API"]
  node_reservation_domain["Reservation rules"]
  node_order_domain["Order workflow<br/>[OrderService.cs]"]
  node_catalog["Restaurant records<br/>[Entities]"]
end

subgraph group_storage["Persistence"]
  node_repositories["Data repositories<br/>[Repositories]"]
  node_reservation_repo["Reservation persistence"]
  node_database[("SQL Server data")]
end

subgraph group_identity["Identity and tenancy"]
  node_auth["Authentication and roles<br/>[TokenService.cs]"]
  node_tenant["Tenant context"]
end

node_staff(("Restaurant staff"))
node_external_api_user(("Browser user"))

node_staff -->|"uses"| node_spa
node_spa -->|"calls REST"| node_api
node_spa -.->|"authenticates"| node_auth
node_reservation_ui -->|"renders in"| node_spa
node_service_ui -->|"renders in"| node_spa
node_auth_ui -->|"renders in"| node_spa
node_api -.->|"routes"| node_reservation_api
node_api -.->|"routes"| node_order_api
node_reservation_api -->|"delegates"| node_reservation_domain
node_reservation_domain -->|"checks availability"| node_reservation_repo
node_reservation_repo -->|"queries and saves"| node_database
node_order_api -.->|"delegates"| node_order_domain
node_order_domain -->|"uses table and menu"| node_catalog
node_order_domain -.->|"loads and saves orders"| node_repositories
node_kitchen_api -.->|"serves kitchen workflow"| node_order_domain
node_repositories -->|"accesses"| node_database
node_api -->|"configures"| node_tenant
node_tenant -->|"scopes queries"| node_database
node_database -->|"persists"| node_catalog

click node_spa "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/app.ts"
click node_reservation_ui "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/reservation-form/reservation-form.component.ts"
click node_service_ui "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/table-list/table-list.component.ts"
click node_auth_ui "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/login/login.ts"
click node_api "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Program.cs"
click node_reservation_api "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/ReservationController.cs"
click node_order_api "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/OrderController.cs"
click node_kitchen_api "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/KitchenController.cs"
click node_reservation_domain "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.Domain/Services/ReservationService.cs"
click node_order_domain "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.Domain/Services/OrderService.cs"
click node_catalog "https://github.com/juniorfai/sistemarestaurantev2/tree/main/SistemaRestaurante.Domain/Entities"
click node_auth "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Auth/TokenService.cs"
click node_tenant "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Auth/HttpTenantContext.cs"
click node_repositories "https://github.com/juniorfai/sistemarestaurantev2/tree/main/SistemaRestaurante.DataAccess/Repositories"
click node_reservation_repo "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.DataAccess/Repositories/ReservationRepository.cs"
click node_database "https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs"

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_spa,node_reservation_ui,node_service_ui,node_auth_ui,node_external_api_user toneBlue
class node_api,node_reservation_api,node_order_api,node_kitchen_api,node_reservation_domain,node_order_domain,node_catalog toneAmber
class node_repositories,node_reservation_repo,node_database toneMint
class node_auth,node_tenant toneRose
class node_staff toneIndigo
```

## Components

### Staff interface

- [Angular application](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/app.ts): `SistemaRestaurante-Front/src/app/app.ts`
- [Reservation screens](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/reservation-form/reservation-form.component.ts): `SistemaRestaurante-Front/src/app/components/reservation-form/reservation-form.component.ts`
- [Table-service screens](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/table-list/table-list.component.ts): `SistemaRestaurante-Front/src/app/components/table-list/table-list.component.ts`
- [Login and account](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante-Front/src/app/components/login/login.ts): `SistemaRestaurante-Front/src/app/components/login/login.ts`

### API and domain

- [REST API](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Program.cs): `SistemaRestaurante.API/Program.cs`
- [Reservation endpoints](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/ReservationController.cs): `SistemaRestaurante.API/Controllers/ReservationController.cs`
- [Order endpoints](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/OrderController.cs): `SistemaRestaurante.API/Controllers/OrderController.cs`
- [Kitchen screens API](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Controllers/KitchenController.cs): `SistemaRestaurante.API/Controllers/KitchenController.cs`
- [Reservation rules](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.Domain/Services/ReservationService.cs): `SistemaRestaurante.Domain/Services/ReservationService.cs`
- [Order workflow](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.Domain/Services/OrderService.cs): `SistemaRestaurante.Domain/Services/OrderService.cs`
- [Restaurant records](https://github.com/juniorfai/sistemarestaurantev2/tree/main/SistemaRestaurante.Domain/Entities): `SistemaRestaurante.Domain/Entities`

### Persistence

- [Data repositories](https://github.com/juniorfai/sistemarestaurantev2/tree/main/SistemaRestaurante.DataAccess/Repositories): `SistemaRestaurante.DataAccess/Repositories`
- [Reservation persistence](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.DataAccess/Repositories/ReservationRepository.cs): `SistemaRestaurante.DataAccess/Repositories/ReservationRepository.cs`
- [SQL Server data](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs): `SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs`

### Identity and tenancy

- [Authentication and roles](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Auth/TokenService.cs): `SistemaRestaurante.API/Auth/TokenService.cs`
- [Tenant context](https://github.com/juniorfai/sistemarestaurantev2/blob/main/SistemaRestaurante.API/Auth/HttpTenantContext.cs): `SistemaRestaurante.API/Auth/HttpTenantContext.cs`

### Other components

- **Restaurant staff**
- **Browser user**

## Connections

- Restaurant staff → Angular application: uses
- Angular application → REST API: calls REST
- Angular application → Authentication and roles: authenticates
- Reservation screens → Angular application: renders in
- Table-service screens → Angular application: renders in
- Login and account → Angular application: renders in
- REST API → Reservation endpoints: routes
- REST API → Order endpoints: routes
- Reservation endpoints → Reservation rules: delegates (evidence: `SistemaRestaurante.API/Controllers/ReservationController.cs`)
- Reservation rules → Reservation persistence: checks availability (evidence: `SistemaRestaurante.Domain/Services/ReservationService.cs`)
- Reservation persistence → SQL Server data: queries and saves (evidence: `SistemaRestaurante.DataAccess/Repositories/ReservationRepository.cs`)
- Order endpoints → Order workflow: delegates
- Order workflow → Restaurant records: uses table and menu (evidence: `SistemaRestaurante.Domain/Services/OrderService.cs`)
- Order workflow → Data repositories: loads and saves orders
- Kitchen screens API → Order workflow: serves kitchen workflow
- Data repositories → SQL Server data: accesses (evidence: `SistemaRestaurante.DataAccess/Repositories/OrderRepository.cs`)
- REST API → Tenant context: configures (evidence: `SistemaRestaurante.API/Program.cs`)
- Tenant context → SQL Server data: scopes queries (evidence: `SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs`)
- SQL Server data → Restaurant records: persists (evidence: `SistemaRestaurante.DataAccess/Context/RestaurantDbContext.cs`)
