# manuelrisco/pizza_hut_mvp architecture

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

- Interactive diagram: https://gitdiagram.com/manuelrisco/pizza_hut_mvp
- Repository: https://github.com/manuelrisco/pizza_hut_mvp

## Overview

#### Purpose and Deployment Shape
This is a full-stack pizza ordering and administration system. `Frontend` is an Angular single-page application for customers and administrators; `Backend/demo` is a Java/Spring backend exposing the domain API and persistence layer. Docker assets exist for both tiers and root orchestration: `docker-compose.yml`, `Frontend/Dockerfile`, `Backend/demo/Dockerfile`.

#### Application Entry Points
Angular boots from `Frontend/src/main.ts`, configures providers in `Frontend/src/app/app.config.ts`, and defines client navigation in `Frontend/src/app/app.routes.ts`. The backend starts at `Backend/demo/src/main/java/com/example/DemoApplication.java`; runtime properties are under `Backend/demo/src/main/resources/application.properties`. Production frontend content is intended to be served through Nginx (`Frontend/nginx.conf`).

#### Client Routing, Access, and API Boundary
The SPA organizes screens into customer-facing ordering/account flows and administrative catalog/operations flows. Route-level authorization is enforced by `Frontend/src/app/guards/cliente.guard.ts` and `Frontend/src/app/guards/admin.guard.ts`. HTTP requests cross the frontend/backend boundary through domain services, with JWT attachment and centralized failures handled by `Frontend/src/app/interceptors/auth.interceptor.ts` and `Frontend/src/app/interceptors/error.interceptor.ts`. Authentication state/API interaction centers on `Frontend/src/app/services/auth.service.ts`.

#### Backend HTTP and Security Pipeline
Spring controllers form the REST boundary for users, catalog, orders, payments, and operational records; representative endpoints are `Backend/demo/src/main/java/com/example/controllers/UsuarioController.java`, `Backend/demo/src/main/java/com/example/controllers/PizzaController.java`, and `Backend/demo/src/main/java/com/example/controllers/OrderController.java`. `Backend/demo/src/main/java/com/example/config/SecurityConfig.java` configures security, while `Backend/demo/src/main/java/com/example/security/JwtAuthenticationFilter.java` validates requests using `Backend/demo/src/main/java/com/example/security/JwtTokenProvider.java`. A global audit filter records cross-cutting request activity via `Backend/demo/src/main/java/com/example/security/GlobalAuditFilter.java`.

#### Ordering and Checkout Workflow
Customers browse pizzas, sizes, ingredients, extras, promotions, favorites, and reviews. The frontend maintains cart state in `Frontend/src/app/services/cart.service.ts` and submits checkout through `Frontend/src/app/services/checkout.service.ts`; the backend orchestrates fulfillment in `Backend/demo/src/main/java/com/example/services/CheckoutService.java`. Checkout data is represented at the API boundary by `Backend/demo/src/main/java/com/example/dtos/CheckoutRequestDTO.java`, then produces orders, line items/extras, payment records, and tracking updates through `Backend/demo/src/main/java/com/example/models/Order.java`, `Backend/demo/src/main/java/com/example/models/Payment.java`, and `Backend/demo/src/main/java/com/example/models/OrderTracking.java`.

#### Domain and Persistence Layer
Backend services own business operations and repositories own database access, with JPA-style entities modeling the relational domain. The product catalog is anchored by `Backend/demo/src/main/java/com/example/models/Pizza.java`, `Backend/demo/src/main/java/com/example/models/Ingredient.java`, and `Backend/demo/src/main/java/com/example/models/Promotion.java`; user/account data includes addresses, payment methods, sessions, and favorites. Controllers should exchange DTOs rather than entities, as represented by `Backend/demo/src/main/java/com/example/dtos/PizzaDTO.java` and mapping components such as `Backend/demo/src/main/java/com/example/mappers/PizzaMapper.java`. Persistence boundaries include `Backend/demo/src/main/java/com/example/repositories/PizzaRepository.java` and `Backend/demo/src/main/java/com/example/repositories/OrderRepository.java`.

#### Administration, Audit, and Error Boundaries
Admin UI components manage pizzas, ingredients, sizes, promotions, users, payments, and orders, with the main control surface at `Frontend/src/app/componentes/panel-admin/panel-admin.ts`. Backend audit/session resources support operational traceability through `Backend/demo/src/main/java/com/example/services/AuditLogService.java` and `Backend/demo/src/main/java/com/example/services/SessionLogService.java`. Validation and domain failures are normalized at the API boundary by `Backend/demo/src/main/java/com/example/exceptions/GlobalExceptionHandler.java`; user creation/validation additionally uses explicit strategy/factory patterns in `Backend/demo/src/main/java/com/example/patterns/users/comportamiento/UsuarioValidator.java` and `Backend/demo/src/main/java/com/example/patterns/users/creacionales/UsuarioFactory.java`.

Main entry points: [`Backend/demo/src/main/java/com/example/controllers/OrderController.java`](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/controllers/OrderController.java) (REST controllers), [`Frontend/src/main.ts`](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/main.ts) (SPA bootstrap & routes), [`Backend/demo/src/main/java/com/example/services/CheckoutService.java`](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/services/CheckoutService.java) (Checkout orchestration), [`Frontend/src/app/interceptors/auth.interceptor.ts`](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/interceptors/auth.interceptor.ts) (HTTP interceptors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Angular SPA"]
  node_spa_bootstrap["SPA bootstrap &amp; routes<br/>Angular entry<br/>[main.ts]"]
  node_client_access["Route guards<br/>client authorization<br/>[cliente.guard.ts]"]
  node_client_http["HTTP interceptors<br/>JWT and error boundary"]
  node_auth_client["Authentication service<br/>client auth API<br/>[auth.service.ts]"]
  node_cart["Cart state<br/>client state<br/>[cart.service.ts]"]
  node_checkout_client["Checkout service<br/>client API"]
  node_admin_ui["Admin panel<br/>admin control surface<br/>[panel-admin.ts]"]
end

subgraph group_backend["Spring API"]
  node_controllers["REST controllers<br/>HTTP API"]
  node_security["Security pipeline<br/>JWT authentication"]
  node_jwt_filter["JWT filter<br/>request filter"]
  node_audit_filter["Global audit filter<br/>request audit"]
  node_checkout_service["Checkout orchestration<br/>domain service"]
  node_checkout_dto["Checkout request<br/>API DTO"]
  node_catalog_domain["Catalog domain<br/>JPA entities<br/>[Pizza.java]"]
  node_order_domain["Order fulfillment domain<br/>JPA entities<br/>[Order.java]"]
  node_repositories["Repositories<br/>persistence access"]
  node_api_errors["Exception handler<br/>API error boundary"]
  node_audit_services["Audit &amp; session logs<br/>operational services"]
end

subgraph group_deployment["Deployment"]
  node_runtime{{"Docker deployment<br/>tier orchestration<br/>[docker-compose.yml]"}}
end

node_spa_bootstrap -->|"applies route access"| node_client_access
node_spa_bootstrap -->|"uses"| node_auth_client
node_spa_bootstrap -->|"uses"| node_cart
node_spa_bootstrap -->|"uses"| node_checkout_client
node_spa_bootstrap -->|"routes to"| node_admin_ui
node_auth_client -->|"requests through"| node_client_http
node_checkout_client -->|"requests through"| node_client_http
node_admin_ui -->|"manages through"| node_client_http
node_client_http -->|"REST requests with JWT"| node_controllers
node_security -->|"configures"| node_jwt_filter
node_jwt_filter -->|"authenticates requests"| node_controllers
node_audit_filter -->|"records activity"| node_audit_services
node_controllers -.->|"normalizes failures"| node_api_errors
node_controllers -->|"accepts"| node_checkout_dto
node_controllers -->|"delegates checkout"| node_checkout_service
node_controllers -->|"serves catalog"| node_catalog_domain
node_checkout_dto -->|"input"| node_checkout_service
node_checkout_service -->|"creates orders and payments"| node_order_domain
node_checkout_service -->|"persists through"| node_repositories
node_catalog_domain -->|"persisted by"| node_repositories
node_order_domain -->|"persisted by"| node_repositories
node_runtime -.->|"deploys frontend"| node_spa_bootstrap
node_runtime -.->|"deploys backend"| node_controllers

click node_spa_bootstrap "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/main.ts"
click node_client_access "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/guards/cliente.guard.ts"
click node_client_http "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/interceptors/auth.interceptor.ts"
click node_auth_client "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/auth.service.ts"
click node_cart "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/cart.service.ts"
click node_checkout_client "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/checkout.service.ts"
click node_admin_ui "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/componentes/panel-admin/panel-admin.ts"
click node_controllers "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/controllers/OrderController.java"
click node_security "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/config/SecurityConfig.java"
click node_jwt_filter "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/security/JwtAuthenticationFilter.java"
click node_audit_filter "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/security/GlobalAuditFilter.java"
click node_checkout_service "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/services/CheckoutService.java"
click node_checkout_dto "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/dtos/CheckoutRequestDTO.java"
click node_catalog_domain "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/models/Pizza.java"
click node_order_domain "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/models/Order.java"
click node_repositories "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/repositories/OrderRepository.java"
click node_api_errors "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/exceptions/GlobalExceptionHandler.java"
click node_audit_services "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/services/AuditLogService.java"
click node_runtime "https://github.com/manuelrisco/pizza_hut_mvp/blob/main/docker-compose.yml"

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_bootstrap,node_client_access,node_client_http,node_auth_client,node_cart,node_checkout_client,node_admin_ui toneBlue
class node_controllers,node_security,node_jwt_filter,node_audit_filter,node_checkout_service,node_checkout_dto,node_catalog_domain,node_order_domain,node_repositories,node_api_errors,node_audit_services toneAmber
class node_runtime toneMint
```

## Components

### Angular SPA

- [SPA bootstrap & routes](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/main.ts): Angular entry · `Frontend/src/main.ts`
- [Route guards](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/guards/cliente.guard.ts): client authorization · `Frontend/src/app/guards/cliente.guard.ts`
- [HTTP interceptors](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/interceptors/auth.interceptor.ts): JWT and error boundary · `Frontend/src/app/interceptors/auth.interceptor.ts`
- [Authentication service](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/auth.service.ts): client auth API · `Frontend/src/app/services/auth.service.ts`
- [Cart state](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/cart.service.ts): client state · `Frontend/src/app/services/cart.service.ts`
- [Checkout service](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/services/checkout.service.ts): client API · `Frontend/src/app/services/checkout.service.ts`
- [Admin panel](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Frontend/src/app/componentes/panel-admin/panel-admin.ts): admin control surface · `Frontend/src/app/componentes/panel-admin/panel-admin.ts`

### Spring API

- [REST controllers](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/controllers/OrderController.java): HTTP API · Users, catalog, orders, payments, and operations endpoints. · `Backend/demo/src/main/java/com/example/controllers/OrderController.java`
- [Security pipeline](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/config/SecurityConfig.java): JWT authentication · `Backend/demo/src/main/java/com/example/config/SecurityConfig.java`
- [JWT filter](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/security/JwtAuthenticationFilter.java): request filter · `Backend/demo/src/main/java/com/example/security/JwtAuthenticationFilter.java`
- [Global audit filter](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/security/GlobalAuditFilter.java): request audit · `Backend/demo/src/main/java/com/example/security/GlobalAuditFilter.java`
- [Checkout orchestration](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/services/CheckoutService.java): domain service · `Backend/demo/src/main/java/com/example/services/CheckoutService.java`
- [Checkout request](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/dtos/CheckoutRequestDTO.java): API DTO · `Backend/demo/src/main/java/com/example/dtos/CheckoutRequestDTO.java`
- [Catalog domain](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/models/Pizza.java): JPA entities · Pizzas, ingredients, promotions, sizes, and extras. · `Backend/demo/src/main/java/com/example/models/Pizza.java`
- [Order fulfillment domain](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/models/Order.java): JPA entities · Orders, payments, line items, and tracking. · `Backend/demo/src/main/java/com/example/models/Order.java`
- [Repositories](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/repositories/OrderRepository.java): persistence access · `Backend/demo/src/main/java/com/example/repositories/OrderRepository.java`
- [Exception handler](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/exceptions/GlobalExceptionHandler.java): API error boundary · `Backend/demo/src/main/java/com/example/exceptions/GlobalExceptionHandler.java`
- [Audit & session logs](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/Backend/demo/src/main/java/com/example/services/AuditLogService.java): operational services · `Backend/demo/src/main/java/com/example/services/AuditLogService.java`

### Deployment

- [Docker deployment](https://github.com/manuelrisco/pizza_hut_mvp/blob/main/docker-compose.yml): tier orchestration · Composes frontend and Spring backend containers. · `docker-compose.yml`

## Connections

- SPA bootstrap & routes → Route guards: applies route access
- SPA bootstrap & routes → Authentication service: uses
- SPA bootstrap & routes → Cart state: uses
- SPA bootstrap & routes → Checkout service: uses
- SPA bootstrap & routes → Admin panel: routes to
- Authentication service → HTTP interceptors: requests through
- Checkout service → HTTP interceptors: requests through
- Admin panel → HTTP interceptors: manages through
- HTTP interceptors → REST controllers: REST requests with JWT
- Security pipeline → JWT filter: configures
- JWT filter → REST controllers: authenticates requests
- Global audit filter → Audit & session logs: records activity
- REST controllers → Exception handler: normalizes failures
- REST controllers → Checkout request: accepts
- REST controllers → Checkout orchestration: delegates checkout
- REST controllers → Catalog domain: serves catalog
- Checkout request → Checkout orchestration: input
- Checkout orchestration → Order fulfillment domain: creates orders and payments
- Checkout orchestration → Repositories: persists through
- Catalog domain → Repositories: persisted by
- Order fulfillment domain → Repositories: persisted by
- Docker deployment → SPA bootstrap & routes: deploys frontend
- Docker deployment → REST controllers: deploys backend
