# bannik62/pil_oh_poil architecture

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

- Interactive diagram: https://gitdiagram.com/bannik62/pil_oh_poil
- Repository: https://github.com/bannik62/pil_oh_poil

## Overview

##### Main components
- Frontend Component:
- Built with Svelte and Vite.
- Contains UI components organized into directories (e.g., components for "acceuil" and "module").
- Uses Svelte stores for state management as seen in the “stores” directory.
- Dockerfile and configuration files (e.g., vite.config.js, svelte.config.js) show bundling and dev server setup.
- Backend Component:
- A Node.js project with its own package.json.
- Uses Sequelize (indicated by .sequelizerc, migrations, config, models).
- Contains middleware (e.g., CSRF protection, email validation), routes (separated into subdirectories for user-related actions like login and registration), and validations.
- Has a Dockerfile and deployment configurations.
- Database (Implicit):
- Although not explicit from file names, the use of migrations and Sequelize implies integration with a relational database.
- Docker Environment:
- Presence of Docker-related files (docker-compose.yaml, Dockerfiles in frontend and backend, and documentation on Docker setups) indicates containerization for both the server and potentially the client.
- Documentation Component:
- The “documentation” folder contains various guides and HTML files on environment setup and even integration with Svelte – useful for understanding deployment and environment concerns.

##### Relationships and interactions
- That the Backend interacts with a Database by illustrating an “ORM layer” (Sequelize) that handles migrations and model definitions.
- Components for middleware and routing inside the Backend to indicate request handling (authentication, validation, security).
- Docker as an environment containerizing both the Frontend and Backend, with docker-compose coordinating multi-container deployments.
- If desired, highlight additional documentation or integration layers used for setup and environment management.

##### Architectural patterns and design principles
- Separation of concerns: Clear division between frontend (presentation, state management, UI components) and backend (business logic, API endpoints, database interactions).
- Modular design: Both backend and frontend directories are organized into logical modules (e.g., middleware, models, validations on the backend; components, stores on the frontend).
- Containerization for deployment: Use of Docker/Docker Compose to encapsulate the environments.
- Routing and middleware: Custom routing (e.g., userRouteLogin, userRouteRegister) with middleware layers for security and validation.

##### Relevant technologies
- Frontend: Svelte, Vite, and Svelte stores.
- Backend: Node.js, Express-like routing, Sequelize ORM, middleware for CSRF and email validation.
- Database: (Assumed SQL database; actual technology might be PostgreSQL, MySQL, etc., as determined during deployment).
- Containerization: Docker and Docker Compose.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (Svelte + Vite)"
        FE1["Frontend Application"]:::frontend
        FE2["UI - Acceuil Components"]:::frontend
        FE3["UI - Module Components"]:::frontend
        FE4["Svelte Stores"]:::frontend
        FE1 --> FE2
        FE1 --> FE3
        FE1 --> FE4
    end

    subgraph "Backend (Node.js + Sequelize)"
        BE1["Backend Server"]:::backend
        BE2["API Routing (Users)"]:::backend
        BE3["Middleware Components"]:::backend
        BE4["Request Validations"]:::backend
        BE5_1["DB Config"]:::backend
        BE5_2["Migrations"]:::backend
        BE5_3["Model Definitions"]:::backend
        BE1 --> BE2
        BE2 --> BE3
        BE2 --> BE4
        BE2 --> BE5_1
        BE2 --> BE5_2
        BE2 --> BE5_3
    end

    DB["SQL Database"]:::database
    BE5_1 -->|"Configures"| DB
    BE5_2 -->|"Migrates"| DB
    BE5_3 -->|"Maps"| DB

    FE1 ---|"HTTP/API"| BE1

    subgraph "Docker Environment"
        D1["Docker Compose"]:::docker
        D2["Frontend Dockerfile"]:::docker
        D3["Backend Dockerfile"]:::docker
        D1 --> D2
        D1 --> D3
    end

    DOC["Documentation & Guides"]:::documentation
    DOC --> FE1
    DOC --> BE1

    %% Click Events
    click FE1 "https://github.com/bannik62/pil_oh_poil/tree/main/frontend/"
    click FE2 "https://github.com/bannik62/pil_oh_poil/tree/main/frontend/src/components/acceuil"
    click FE3 "https://github.com/bannik62/pil_oh_poil/tree/main/frontend/src/components/module"
    click FE4 "https://github.com/bannik62/pil_oh_poil/tree/main/frontend/src/stores"
    click BE1 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/"
    click BE2 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/src/routes/users"
    click BE3 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/src/middleware"
    click BE4 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/src/validations"
    click BE5_1 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/config"
    click BE5_2 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/migrations"
    click BE5_3 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/models"
    click D1 "https://github.com/bannik62/pil_oh_poil/blob/main/docker-compose.yaml"
    click D2 "https://github.com/bannik62/pil_oh_poil/tree/main/frontend/Dockerfile"
    click D3 "https://github.com/bannik62/pil_oh_poil/tree/main/backend/Dockerfile"
    click DOC "https://github.com/bannik62/pil_oh_poil/tree/main/documentation/"

    %% Styles
    classDef frontend fill:#b3e6b3,stroke:#2d862d,stroke-width:2px;
    classDef backend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef database fill:#fff3cd,stroke:#856404,stroke-width:2px,stroke-dasharray: 5 5;
    classDef docker fill:#ffe6cc,stroke:#cc5200,stroke-width:2px;
    classDef documentation fill:#e6ccff,stroke:#6600cc,stroke-width:2px;
```
