# wallacef3lip/sistema_pdv architecture

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

- Interactive diagram: https://gitdiagram.com/wallacef3lip/sistema_pdv
- Repository: https://github.com/wallacef3lip/sistema_pdv

## Overview

Sistema PDV is a retail point-of-sale application: staff authenticate, manage products and stock, record and settle sales, operate the cash register, and review reports. Angular pages call API services; FastAPI routers expose domain operations backed by SQLAlchemy models and PostgreSQL. The graph preserves documented customer, delivery, access-control, and reporting capabilities. Some subsystem paths and links use directory-level evidence because their individual files were not excerpted; those links are omitted where the caller relationship could not be verified.

Main entry points: [`pdv_View/src/app/app.routes.ts`](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/app.routes.ts) (Page routing), [`pdv_API/app/routers`](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/routers) (Business API routes), [`pdv_API/app/services/sale_service.py`](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/sale_service.py) (Sale lifecycle), [`pdv_API/main.py`](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/main.py) (API application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_routes["Page routing<br/>[app.routes.ts]"]
  node_login["Login<br/>[login.component.ts]"]
  node_sales_ui["Sales and orders"]
  node_inventory_ui["Products and stock"]
  node_cash_ui["Cash register"]
  node_customers_ui["Customers and zones"]
  node_reports_ui["Reports"]
  node_client_services["HTTP services"]
  node_print["Receipt printing<br/>[print.service.ts]"]
end

subgraph group_api["FastAPI domain"]
  node_api_app["API application<br/>[main.py]"]
  node_domain_routes["Business API routes"]
  node_sale_service["Sale lifecycle<br/>[sale_service.py]"]
  node_cash_service["Cash operations"]
  node_stock_service["Stock movements<br/>[stock_service.py]"]
  node_customer_services["Customer and zone services"]
  node_report_service["Report generation<br/>[report_service.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_storage["Persistence"]
  node_models["Domain records"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_security["Token and role checks<br/>[security.py]"]
end

node_staff(("Retail staff"))

node_staff -->|"signs in"| node_login
node_staff -->|"records sales"| node_sales_ui
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_sales_ui
node_routes -->|"routes to"| node_inventory_ui
node_routes -->|"routes to"| node_cash_ui
node_routes -->|"routes to"| node_customers_ui
node_routes -->|"routes to"| node_reports_ui
node_login -.->|"uses auth"| node_client_services
node_sales_ui -->|"calls sales"| node_client_services
node_reports_ui -->|"calls reports"| node_client_services
node_client_services -.->|"HTTP requests"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_domain_routes
node_auth_routes -->|"uses security"| node_security
node_domain_routes -->|"delegates sales"| node_sale_service
node_domain_routes -->|"delegates cash"| node_cash_service
node_sale_service -->|"registers payments"| node_cash_service
node_sale_service -->|"checks stock"| node_stock_service
node_sale_service -->|"validates delivery"| node_customer_services
node_domain_routes -.->|"serves reports"| node_report_service
node_domain_routes -->|"validates payloads"| node_schemas
node_sale_service -->|"queries records"| node_models
node_cash_service -->|"queries records"| node_models
node_report_service -->|"queries records"| node_models
node_models -->|"uses ORM base"| node_db_session
node_api_app -->|"creates tables"| node_db_session
node_db_session -->|"opens connections"| node_postgres
node_print -.->|"prints receipts"| node_sales_ui

click node_routes "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/app.routes.ts"
click node_login "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/login/login.component.ts"
click node_sales_ui "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages"
click node_inventory_ui "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages"
click node_cash_ui "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/cash-register/cash-register.component.ts"
click node_customers_ui "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages"
click node_reports_ui "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/reports/reports.component.ts"
click node_client_services "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/core/services"
click node_print "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/core/services/print.service.ts"
click node_api_app "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/main.py"
click node_auth_routes "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/routers/auth.py"
click node_security "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/core/security.py"
click node_domain_routes "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/routers"
click node_sale_service "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/sale_service.py"
click node_cash_service "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/cash_register_service.py"
click node_stock_service "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/stock_service.py"
click node_customer_services "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/services"
click node_report_service "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/report_service.py"
click node_schemas "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/schemas/schemas.py"
click node_models "https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/models"
click node_db_session "https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/core/database.py"

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_routes,node_login,node_sales_ui,node_inventory_ui,node_cash_ui,node_customers_ui,node_reports_ui,node_client_services,node_print toneBlue
class node_api_app,node_domain_routes,node_sale_service,node_cash_service,node_stock_service,node_customer_services,node_report_service,node_schemas toneAmber
class node_models,node_db_session,node_postgres toneMint
class node_auth_routes,node_security toneRose
class node_staff toneIndigo
```

## Components

### Angular client

- [Page routing](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/app.routes.ts): `pdv_View/src/app/app.routes.ts`
- [Login](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/login/login.component.ts): `pdv_View/src/app/pages/login/login.component.ts`
- [Sales and orders](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages): `pdv_View/src/app/pages`
- [Products and stock](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages): `pdv_View/src/app/pages`
- [Cash register](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/cash-register/cash-register.component.ts): `pdv_View/src/app/pages/cash-register/cash-register.component.ts`
- [Customers and zones](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/pages): `pdv_View/src/app/pages`
- [Reports](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/pages/reports/reports.component.ts): `pdv_View/src/app/pages/reports/reports.component.ts`
- [HTTP services](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_View/src/app/core/services): `pdv_View/src/app/core/services`
- [Receipt printing](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_View/src/app/core/services/print.service.ts): `pdv_View/src/app/core/services/print.service.ts`

### FastAPI domain

- [API application](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/main.py): `pdv_API/main.py`
- [Business API routes](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/routers): `pdv_API/app/routers`
- [Sale lifecycle](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/sale_service.py): `pdv_API/app/services/sale_service.py`
- [Cash operations](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/cash_register_service.py): `pdv_API/app/services/cash_register_service.py`
- [Stock movements](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/stock_service.py): `pdv_API/app/services/stock_service.py`
- [Customer and zone services](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/services): `pdv_API/app/services`
- [Report generation](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/services/report_service.py): `pdv_API/app/services/report_service.py`
- [Request and response schemas](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/schemas/schemas.py): `pdv_API/app/schemas/schemas.py`

### Persistence

- [Domain records](https://github.com/wallacef3lip/sistema_pdv/tree/main/pdv_API/app/models): `pdv_API/app/models`
- [Database sessions](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/core/database.py): `pdv_API/app/core/database.py`
- **PostgreSQL**

### Identity and access

- [Authentication routes](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/routers/auth.py): `pdv_API/app/routers/auth.py`
- [Token and role checks](https://github.com/wallacef3lip/sistema_pdv/blob/main/pdv_API/app/core/security.py): `pdv_API/app/core/security.py`

### Other components

- **Retail staff**

## Connections

- Retail staff → Login: signs in (evidence: `README.md`)
- Retail staff → Sales and orders: records sales (evidence: `README.md`)
- Page routing → Login: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Page routing → Sales and orders: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Page routing → Products and stock: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Page routing → Cash register: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Page routing → Customers and zones: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Page routing → Reports: routes to (evidence: `pdv_View/src/app/app.routes.ts`)
- Login → HTTP services: uses auth
- Sales and orders → HTTP services: calls sales (evidence: `pdv_View/src/app/pages/orders/orders.component.ts`)
- Reports → HTTP services: calls reports (evidence: `pdv_View/src/app/pages/reports/reports.component.ts`)
- HTTP services → API application: HTTP requests (evidence: `pdv_View/src/app/core/services/sale.service.ts`)
- API application → Authentication routes: registers (evidence: `pdv_API/main.py`)
- API application → Business API routes: registers (evidence: `pdv_API/main.py`)
- Authentication routes → Token and role checks: uses security (evidence: `pdv_API/app/routers/auth.py`)
- Business API routes → Sale lifecycle: delegates sales (evidence: `pdv_API/app/routers/sales.py`)
- Business API routes → Cash operations: delegates cash (evidence: `pdv_API/app/routers/cash_registers.py`)
- Sale lifecycle → Cash operations: registers payments (evidence: `pdv_API/app/services/sale_service.py`)
- Sale lifecycle → Stock movements: checks stock (evidence: `pdv_API/app/services/sale_service.py`)
- Sale lifecycle → Customer and zone services: validates delivery (evidence: `pdv_API/app/services/sale_service.py`)
- Business API routes → Report generation: serves reports
- Business API routes → Request and response schemas: validates payloads (evidence: `pdv_API/app/routers/sales.py`)
- Sale lifecycle → Domain records: queries records (evidence: `pdv_API/app/services/sale_service.py`)
- Cash operations → Domain records: queries records (evidence: `pdv_API/app/services/cash_register_service.py`)
- Report generation → Domain records: queries records (evidence: `pdv_API/app/services/report_service.py`)
- Domain records → Database sessions: uses ORM base (evidence: `pdv_API/app/models/sale.py`)
- API application → Database sessions: creates tables (evidence: `pdv_API/main.py`)
- Database sessions → PostgreSQL: opens connections (evidence: `pdv_API/app/core/database.py`)
- Receipt printing → Sales and orders: prints receipts (evidence: `pdv_View/src/app/pages/orders/orders.component.ts`)
