# abnerastete/hells-kitchen architecture

> Architecture diagram of the GitHub repository abnerastete/hells-kitchen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abnerastete/hells-kitchen
- Repository: https://github.com/abnerastete/hells-kitchen

## Overview

##### Main Components

a) API Layer
- FastAPI application (main.py) as the entry point
- Router component (router/item.py) as the request handler layer

b) Business Logic Layer
- Model package (model/model.py) representing the business logic
- Schemas package (schemas/schemas.py) for data validation and serialization

c) Data Layer
- Database package (database/database.py, database/crud.py)
- Database connection and CRUD operations

d) Infrastructure
- Docker container (represented by Dockerfile)
- Docker Compose environment (docker-compose.yml)

##### Component Relationships

- External Clients → API Layer (HTTP requests)
- API Layer → Business Logic Layer
- Business Logic Layer → Data Layer
- Data Layer → Database (external)

**┌─────────────────────────────────────── Docker Container ───────────────────────────────────────┐**

- ┌─────────────┐     ┌─────────────────┐      ┌──────────────────┐     ┌──────────────┐    │
- FastAPI   │     │    Routers      │      │  Business Logic  │     │   Database   │    │
- Server    │ --> │   (item.py)     │ ---> │    Layer        │ --> │    Layer     │    │
- (main.py)  │     │                 │      │  (model.py)      │     │  (crud.py)   │    │
- ┘     └─────────────────┘      └──────────────────┘     └──────────────┘    │
- ↑                      ↕                       ↕                       ↕             │
- ┌─────────────────┐      ┌──────────────────┐           │             │
- Schemas      │      │     Database     │           │             │
- Validation    │      │    Connection    │───────────┘             │
- (schemas.py)   │      │  (database.py)   │                         │
- ┘      └──────────────────┘                         │

- ┘

##### Additional Elements

a) External Dependencies:
- Database system (likely PostgreSQL or similar)
- External services if mentioned in requirements.txt

b) Configuration:
- Configuration files and their relationship to components
- Environment variables flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Container[Docker Container]
        subgraph APILayer[API Layer]
            FastAPI[FastAPI Server]:::api
            Router[Request Router]:::api
        end

        subgraph BusinessLayer[Business Logic Layer]
            Model[Business Logic Model]:::business
            Schemas[Data Validation Schemas]:::business
        end

        subgraph DataLayer[Data Layer]
            DBConn[Database Connection]:::data
            CRUD[CRUD Operations]:::data
        end

        FastAPI --> Router
        Router --> Model
        Router --> Schemas
        Model --> DBConn
        Model --> CRUD
        Schemas --> Model
        DBConn --> CRUD
    end

    ExternalDB[(External Database)]:::external
    Client([External Client]):::client

    Client --> FastAPI
    CRUD --> ExternalDB

    classDef api fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef client fill:#9b59b6,stroke:#8e44ad,color:white

    click FastAPI "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/main.py"
    click Router "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/router/item.py"
    click Model "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/model/model.py"
    click Schemas "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/schemas/schemas.py"
    click DBConn "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/database/database.py"
    click CRUD "https://github.com/AbnerAstete/Hells-Kitchen/blob/main/userAPI/database/crud.py"
    click Container "https://github.com/AbnerAstete/Hells-Kitchen/tree/main/userAPI/Dockerfile"

    %% Legend
    subgraph Legend
        API[API Component]:::api
        BL[Business Logic]:::business
        DL[Data Layer]:::data
        EX[External System]:::external
        CL[Client]:::client
    end
```
