# b3-nj0/proyecto_final_ing_soft_ii architecture

> Architecture diagram of the GitHub repository b3-nj0/proyecto_final_ing_soft_ii, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/b3-nj0/proyecto_final_ing_soft_ii
- Repository: https://github.com/b3-nj0/proyecto_final_ing_soft_ii

## Overview

##### Project type and purpose
- This is a full-stack restaurant order management system.
- The backend is a FastAPI-based REST API that handles menu management, order processing, kitchen workflows, and sales reporting.
- The frontend consists of two static web apps:
- An administrative dashboard (SB-Admin-2 template, charts, tables)
- A customer/kitchen portal (plain HTML/JS/CSS for order placement, ticket printing, kitchen view)

##### File structure
- Top-level:
- Backend/ – the API server
- Frontend/ – two separate UIs under Front_Dashboard and Front_Personal-Cliente
- Backend layering:
- app/config – environment & DB connection settings
- app/models – ORM models representing tables (users, products, orders, tickets)
- app/schemas – Pydantic schemas for validation & serialization
- app/routes – router modules for each domain (users, productos, pedidos, tickets)
- app/service – business logic services (CRUD, auth, reporting)
- app/main.py – FastAPI instantiation, middleware, router registration
- Frontend: static HTML/JS/CSS org’d by feature (charts, tables, login/register) using vendor assets.

##### Confirm architecture from README
- Modular router pattern for each business domain
- FastAPI entrypoint orchestrates middleware and router registration for scalability
- RESTful API oriented toward three user workflows (client, kitchen, admin)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        AD["Admin Dashboard UI"]:::ui
        CK["Client/Kitchen UI"]:::ui
    end

    %% Backend Application
    subgraph "Backend: FastAPI" 
        direction TB
        Main["FastAPI App"]:::backend

        subgraph "Config Layer"
            Env["Env Settings"]:::config
            DBConn["DB Connector"]:::config
            CORS["CORS Connector"]:::config
        end

        subgraph "Router Layer"
            UR["User Router"]:::router
            PR["Product Router"]:::router
            OR["Order Router"]:::router
            ODR["Order Detail Router"]:::router
            TR["Ticket Router"]:::router
            DTR["Daily Ticket Router"]:::router
        end

        subgraph "Service Layer"
            AuthS["Auth Service"]:::service
            US["User Service"]:::service
            PS["Product Service"]:::service
            OS["Order Service"]:::service
            ODS["Order Detail Service"]:::service
            TS["Ticket Service"]:::service
            DTS["Daily Ticket Service"]:::service
        end

        subgraph "Data Layer"
            UModel1["User Model"]:::data
            UModel2["Users Model"]:::data
            PModel1["Product Model"]:::data
            PModel2["Products Model"]:::data
            OModel["Order Model"]:::data
            ODModel["Order Detail Model"]:::data
            TModel1["Ticket Model"]:::data
            TModel2["Response Models"]:::data
        end

        subgraph "Schemas"
            USchema1["User Schema"]:::schema
            USchema2["Usuario Schemas"]:::schema
            PSchema1["Product Schema"]:::schema
            PSchema2["Producto Schema"]:::schema
            OSchema1["Pedido Schema"]:::schema
            OSchema2["Detalle Pedido Schema"]:::schema
            TSchema1["Ticket Schema"]:::schema
            TSchema2["Ticket Pedido Schema"]:::schema
            DTSchema["Daily Sales Schema"]:::schema
        end

        %% Internal Connections
        Main --> Env
        Main --> DBConn
        Main --> CORS
        Main --> UR
        Main --> PR
        Main --> OR
        Main --> ODR
        Main --> TR
        Main --> DTR

        UR --> AuthS
        UR --> US
        PR --> PS
        OR --> OS
        ODR --> ODS
        TR --> TS
        DTR --> DTS

        AuthS --> Env
        AuthS --> UModel1
        US --> UModel1
        US --> UModel2
        PS --> PModel1
        PS --> PModel2
        OS --> OModel
        ODS --> ODModel
        TS --> TModel1
        DTS --> TModel2

        UModel1 --> DBConn
        UModel2 --> DBConn
        PModel1 --> DBConn
        PModel2 --> DBConn
        OModel --> DBConn
        ODModel --> DBConn
        TModel1 --> DBConn
        TModel2 --> DBConn

        USchema1 --> UR
        USchema2 --> UR
        PSchema1 --> PR
        PSchema2 --> PR
        OSchema1 --> OR
        OSchema2 --> ODR
        TSchema1 --> TR
        TSchema2 --> TR
        DTSchema --> DTR
    end

    %% Database
    DB["Relational Database"]:::database

    %% External Flows
    AD -->|"HTTP Requests"| Main
    CK -->|"HTTP Requests"| Main
    Main -->|"Queries"| DB
    DB -->|"Responses"| Main

    %% Click Events
    click AD "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/tree/main/Frontend/Front_Dashboard"
    click CK "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/tree/main/Frontend/Front_Personal-Cliente"
    click Main "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/main.py"
    click Env "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/config/settings_env.py"
    click DBConn "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/config/database.py"
    click CORS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/config/conn_front.py"
    click UR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/usuario_routes.py"
    click PR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/producto_routes.py"
    click OR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/pedidos_routes.py"
    click ODR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/detalle_pedidos_routes.py"
    click TR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/ticket_route.py"
    click DTR "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/routes/ticket_diario_routes.py"
    click AuthS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/auth.py"
    click US "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_usuario.py"
    click PS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_producto.py"
    click OS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_pedidos.py"
    click ODS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_detalle_pedidos.py"
    click TS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_ticket.py"
    click DTS "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/service/service_ticket_diario.py"
    click UModel1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/model_user.py"
    click UModel2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/usuarios_models.py"
    click PModel1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/model_producto.py"
    click PModel2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/productos_models.py"
    click OModel "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/model_pedidos.py"
    click ODModel "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/model_detalles_pedidos.py"
    click TModel1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/model_ticket.py"
    click TModel2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/models/response_models.py"
    click USchema1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_user.py"
    click USchema2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/usuario_schemas.py"
    click PSchema1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_producto.py"
    click PSchema2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/producto_schema.py"
    click OSchema1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_pedido.py"
    click OSchema2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_detalle_pedido.py"
    click TSchema1 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_ticket.py"
    click TSchema2 "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_ticket_pedido.py"
    click DTSchema "https://github.com/b3-nj0/proyecto_final_ing_soft_ii/blob/main/Backend/app/schemas/schema_venta_dia.py"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#0366D6
    classDef backend fill:#DFFFE0,stroke:#28A745,color:#28A745
    classDef config fill:#FFF4C1,stroke:#DAA520,color:#DAA520
    classDef router fill:#E0F7FF,stroke:#17A2B8,color:#17A2B8
    classDef service fill:#E6E0FF,stroke:#6F42C1,color:#6F42C1
    classDef data fill:#FFF0E0,stroke:#FD7E14,color:#FD7E14
    classDef schema fill:#F0ECFF,stroke:#7952B3,color:#7952B3
    classDef database fill:#FFE0E0,stroke:#DC3545,color:#DC3545
```
