# nyxsr/park-app architecture

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

- Interactive diagram: https://gitdiagram.com/nyxsr/park-app
- Repository: https://github.com/nyxsr/park-app

## Overview

##### Main Components

a. API Layer
- Elysia.js server running on port 3000
- Route handlers (from src/routes/park.route.ts)
- Endpoint specifications

b. Controller Layer
- Park controller (from src/controllers/park.ts)
- Business logic flow for:
- Vehicle registration
- Parking fee calculation

c. Data Layer
- Mock data store (from src/mock/datas.ts)
- Data models/types (from src/types/park-data.ts and parking-lots.ts)

d. Infrastructure Layer
- Docker container
- Bun runtime environment

- [Client Requests] (Top)
- ↓
- [Docker Container]
- ↓
- [Elysia.js Server (Port 3000)]
- ↓
- [Route Layer (park.route.ts)]
- ↓
- [Controller Layer (park.ts)]
- ↓
- [Mock Data Store (datas.ts)]

##### Additional Details

- Environment configuration (.env)
- TypeScript types and interfaces
- Test coverage (tests/index.test.ts)
- Constants usage (src/constants.ts)

##### Specific Implementation Notes

- Request handling flow
- Data validation and processing
- Mock data interaction
- Response formatting

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        CR[Client Requests]
    end

    subgraph "Infrastructure Layer"
        DC[Docker Container]:::infrastructure
        BR[Bun Runtime]:::infrastructure
        EC[Environment Config]:::infrastructure
    end

    subgraph "API Layer"
        ES["Elysia.js Server (Port 3000)"]:::api
        RH["Route Handlers"]:::api
    end

    subgraph "Controller Layer"
        PC["Park Controller"]:::controller
        direction TB
        subgraph "Business Logic"
            VR["Vehicle Registration"]:::logic
            PF["Parking Fee Calculation"]:::logic
            VT["Vehicle Type/Color Reporting"]:::logic
        end
    end

    subgraph "Data Layer"
        MD["Mock Data Store"]:::data
        subgraph "Data Models"
            PT["Park Types"]:::type
            PL["Parking Lots Types"]:::type
        end
    end

    subgraph "Testing Layer"
        TS["Test Suite"]:::test
    end

    %% Relationships
    CR --> DC
    DC --> BR
    BR --> ES
    ES --> RH
    RH --> PC
    PC --> VR & PF & VT
    VR & PF & VT --> MD
    MD --> PT & PL

    %% Click Events
    click ES "https://github.com/nyxsr/park-app/blob/master/src/index.ts"
    click RH "https://github.com/nyxsr/park-app/blob/master/src/routes/park.route.ts"
    click PC "https://github.com/nyxsr/park-app/blob/master/src/controllers/park.ts"
    click MD "https://github.com/nyxsr/park-app/blob/master/src/mock/datas.ts"
    click PT "https://github.com/nyxsr/park-app/blob/master/src/types/park-data.ts"
    click PL "https://github.com/nyxsr/park-app/blob/master/src/types/parking-lots.ts"
    click DC "https://github.com/nyxsr/park-app/tree/master/Dockerfile"
    click EC "https://github.com/nyxsr/park-app/blob/master/.env"
    click TS "https://github.com/nyxsr/park-app/blob/master/tests/index.test.ts"

    %% Styles
    classDef infrastructure fill:#d3d3d3,stroke:#333
    classDef api fill:#87CEEB,stroke:#333
    classDef controller fill:#98FB98,stroke:#333
    classDef logic fill:#90EE90,stroke:#333
    classDef data fill:#FFE4B5,stroke:#333
    classDef type fill:#F0E68C,stroke:#333
    classDef test fill:#DDA0DD,stroke:#333

    %% Legend
    subgraph Legend
        L1[Infrastructure]:::infrastructure
        L2[API]:::api
        L3[Controller]:::controller
        L4[Business Logic]:::logic
        L5[Data Store]:::data
        L6[Data Types]:::type
        L7[Testing]:::test
    end
```
