# zakariaeloirrak/projet-de-stage architecture

> Architecture diagram of the GitHub repository zakariaeloirrak/projet-de-stage, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zakariaeloirrak/projet-de-stage
- Repository: https://github.com/zakariaeloirrak/projet-de-stage

## Overview

##### Main components
- Client (Web Browser)
- Web Server Layer
– NGINX (or similar)
– WSGI/ASGI server (Gunicorn, Daphne)
- Django Application (“proj” + “application”)
– URL Router (proj/urls.py → application/urls.py)
– Middleware (application/middleware.py + Django built-ins)
– Views & Forms (application/views.py, application/forms.py)
– Templates (application/templates/…)
– Static assets (application/static/…)
– Business Logic & Models (application/models.py)
– Templatetags (application/templatetags)
– Admin Interface (application/admin.py)
– Migrations (application/migrations)
- Database (SQLite / PostgreSQL / MySQL)
- Filesystem storage (documents/ PDF files)

##### Relationships and data flows
a. Client → HTTP Request → NGINX → Gunicorn → Django URL router
b. URL router → Middleware chain → View function/class
c. View → Validate data via Forms → ORM queries to Database
d. View → Business logic → Read/write to “documents/” folder for PDFs
e. View → Render Template + Context → Static files (CSS, JS, images)
f. Django → WSGI server → NGINX → HTTP Response → Client

##### Architectural patterns
- MVC (Django’s MTV) – Models ↔ Templates ↔ Views
- Layered three-tier (Client / Application / Database)
- Monolith: Single codebase & single Django “application” module

##### Key technologies
- Python 3.x, Django framework
- HTML5/CSS3 server-rendered templates
- Django ORM & migrations
- WSGI/ASGI (Gunicorn/Daphne) behind NGINX
- Relational DB (specified in proj/settings.py)
- Local file storage for generated PDFs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Layer
    Client["Web Browser"]:::external
    NGINX["NGINX"]:::external
    Gunicorn["Gunicorn WSGI/ASGI"]:::external

    %% Application Layer
    subgraph "Django Application"
        subgraph "Project Configuration"
            Settings["settings.py"]:::app
            ProjectURLs["proj/urls.py"]:::app
            WSGI["wsgi.py"]:::app
            ASGI["asgi.py"]:::app
            Manage["manage.py"]:::app
        end
        subgraph "Core Components"
            URLRouter["URL Router"]:::app
            Middleware["Middleware"]:::app
            Views["Views"]:::app
            Forms["Forms"]:::app
            Models["Models & Business Logic"]:::app
            Admin["Admin Interface"]:::app
            Templatetags["Templatetags"]:::app
            Migrations["Migrations"]:::app
            Tests["Tests"]:::app
        end
        subgraph "Assets & Templates"
            Templates["Templates"]:::app
            Static["Static Assets"]:::app
        end
    end

    %% Database & Storage
    DB["Database (SQLite/PostgreSQL/MySQL)"]:::db
    FS["Filesystem Storage\n(documents/)"]:::fs

    %% Flow Connections
    Client -->|"HTTP Request"| NGINX
    NGINX -->|"Proxy"| Gunicorn
    Gunicorn -->|"WSGI call"| URLRouter
    URLRouter -->|"passes request"| Middleware
    Middleware -->|"process & forward"| Views
    Views -->|"validate via Forms"| Forms
    Views -->|"ORM Query"| Models
    Models -->|"SQL Query"| DB
    Views -->|"read/write file I/O"| FS
    Views -->|"render with Context"| Templates
    Templates -->|"includes static assets"| Static
    Views -->|"HTTP Response"| Gunicorn
    Gunicorn -->|"Proxy"| NGINX
    NGINX -->|"HTTP Response"| Client

    %% Click Events
    click Settings "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/proj/settings.py"
    click ProjectURLs "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/proj/urls.py"
    click WSGI "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/proj/wsgi.py"
    click ASGI "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/proj/asgi.py"
    click Manage "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/manage.py"
    click URLRouter "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/urls.py"
    click Middleware "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/middleware.py"
    click Views "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/views.py"
    click Forms "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/forms.py"
    click Models "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/models.py"
    click Admin "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/admin.py"
    click Templates "https://github.com/zakariaeloirrak/projet-de-stage/tree/main/application/templates/"
    click Static "https://github.com/zakariaeloirrak/projet-de-stage/tree/main/application/static/"
    click Templatetags "https://github.com/zakariaeloirrak/projet-de-stage/tree/main/application/templatetags/"
    click Migrations "https://github.com/zakariaeloirrak/projet-de-stage/tree/main/application/migrations/"
    click Tests "https://github.com/zakariaeloirrak/projet-de-stage/blob/main/application/tests.py"

    %% Styles
    classDef external fill:#ADD8E6,stroke:#000
    classDef app fill:#90EE90,stroke:#000
    classDef db fill:#FFFF99,stroke:#000
    classDef fs fill:#D3D3D3,stroke:#000
```
