# camillepressense/pause_empathique architecture

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

- Interactive diagram: https://gitdiagram.com/camillepressense/pause_empathique
- Repository: https://github.com/camillepressense/pause_empathique

## Overview

##### Project type and purpose
- This is a monolithic, full-stack Django web application called “Pause Empathique,” designed to guide users through an empathic self-reflection journal inspired by Nonviolent Communication.
- Key goals: present a responsive UI (mobile/desktop), guide users through steps (Observation, Feelings, Needs), persist user entries in a relational database, and serve HTML via Django templates.

##### File structure
- Top-level scripts and configs
- Dockerfile, docker-compose.yml, .env.example → containerized deployment
- pyproject.toml, Poetry → dependency and environment management
- manage.py → Django CLI entry point
- Core Django project:
- pause_empathique/ → project settings (settings.py), URL dispatch (urls.py), ASGI/WGSI entrypoints
- Django application “users”:
- models.py, views.py, admin.py → MVC components for user and journal data
- migrations/ → database schema evolution
- tests.py → unit tests for app logic
- tests/ → end-to-end or integration test suite
- (Implicit) Frontend assets
- Tailwind CSS toolchain via Node.js (likely configured in package.json)—static files compiled into a static/ directory
- Django Templates for HTML pages under templates/

##### README for additional insights
- Backend stack: Django 5.2, PostgreSQL, Python 3.13
- Frontend stack: Tailwind CSS 4.1, vanilla JS, Django Templates
- Dev tools: Docker & Docker Compose, Poetry, Node.js (for CSS build)
- Future work: Alpine.js, data visualization, CI/CD, Railway deployment

a. Main components
1. Client (Browser/Mobile)
2. Load balancer or reverse proxy (e.g., Nginx) – optional, sits in front of the app
3. Django Application Container
– Gunicorn (WSGI) or Daphne (ASGI) server
– Django views, URL router, business logic
– Django templates + static files (Tailwind-compiled CSS, JS)
4. PostgreSQL Database Container
5. (Build-time) Node.js container or step for Tailwind CSS compilation
6. Docker-Compose orchestrator
b. Data flows & interactions
- Browser sends HTTP(S) requests → Nginx (reverse proxy) → Gunicorn/Daphne → Django URL router → views → ORM → PostgreSQL
- ORM maps to models and returns data → views render templates → static assets served by Nginx or Django static serve
- Docker-Compose brings up both web and DB containers, orchestrates network and environment variables
- Local development: manage.py commands (runserver, migrate, test) inside the web container
c. Architectural patterns
- monolithic MVC layered structure (presentation / business / data)
- Containerization pattern using Docker-Compose to isolate services
- Separation of concerns: CSS/JS build (Node) vs runtime (Django)
d. Key technologies
- Django 5.2, Gunicorn/Daphne, PostgreSQL
- Tailwind CSS (Node.js build), vanilla JavaScript, Django templates
- Docker, Docker-Compose, Poetry

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External client
    Browser["Browser (Mobile/Desktop)"]:::external

    %% Configuration & Orchestration
    subgraph "Configuration & Orchestration"
        direction TB
        Dockerfile["Dockerfile"]:::config
        dockerCompose["docker-compose.yml"]:::config
        envExample[".env.example"]:::config
        poetry["pyproject.toml"]:::config
    end

    %% Containers orchestrated by Docker Compose
    subgraph "Docker-Compose Orchestrator" 
        direction TB
        subgraph "Web App Container" 
            direction TB
            Nginx["Nginx Reverse Proxy"]:::container
            Gunicorn["Gunicorn/Daphne Server"]:::container
            managePy["manage.py"]:::container
            subgraph "Django Core"
                direction TB
                settings["settings.py"]:::container
                urls["urls.py"]:::container
                asgi["asgi.py"]:::container
                wsgi["wsgi.py"]:::container
            end
            subgraph "Users App"
                direction TB
                models["models.py"]:::container
                views["views.py"]:::container
                adminCfg["admin.py"]:::container
                appsCfg["apps.py"]:::container
                migrations["migrations/"]:::container
                unitTests["users/tests.py"]:::container
            end
            subgraph "Static Assets"
                direction TB
                TailwindBuild["Node.js/Tailwind Build Step"]:::build
                StaticFiles["Compiled CSS/JS"]:::container
            end
        end

        subgraph "Database Container"
            direction TB
            Postgres["PostgreSQL (5432)"]:::db
        end
    end

    %% Tests outside containers
    integrationTests["tests/ (Integration/E2E)"]:::container

    %% Data flows
    Browser -->|"HTTPS" | Nginx
    Nginx -->|"WSGI/ASGI" | Gunicorn
    Gunicorn -->|"Django CLI" | managePy
    managePy -->|"loads" | settings
    Gunicorn -->|"routes" | urls
    urls -->|"calls" | views
    views -->|"ORM queries" | models
    models -->|"SQL" | Postgres
    views -->|"renders" | StaticFiles
    TailwindBuild -.->|"build-time" | StaticFiles
    dockerCompose -->|"orchestrates" | Nginx
    dockerCompose -->|"orchestrates" | Postgres
    integrationTests -->|"runs against" | WebAppContainer

    %% Click Events
    click Dockerfile "https://github.com/camillepressense/pause_empathique/tree/main/Dockerfile"
    click dockerCompose "https://github.com/camillepressense/pause_empathique/blob/main/docker-compose.yml"
    click envExample "https://github.com/camillepressense/pause_empathique/blob/main/.env.example"
    click poetry "https://github.com/camillepressense/pause_empathique/blob/main/pyproject.toml"
    click managePy "https://github.com/camillepressense/pause_empathique/blob/main/manage.py"
    click settings "https://github.com/camillepressense/pause_empathique/blob/main/pause_empathique/settings.py"
    click urls "https://github.com/camillepressense/pause_empathique/blob/main/pause_empathique/urls.py"
    click asgi "https://github.com/camillepressense/pause_empathique/blob/main/pause_empathique/asgi.py"
    click wsgi "https://github.com/camillepressense/pause_empathique/blob/main/pause_empathique/wsgi.py"
    click models "https://github.com/camillepressense/pause_empathique/blob/main/users/models.py"
    click views "https://github.com/camillepressense/pause_empathique/blob/main/users/views.py"
    click adminCfg "https://github.com/camillepressense/pause_empathique/blob/main/users/admin.py"
    click appsCfg "https://github.com/camillepressense/pause_empathique/blob/main/users/apps.py"
    click migrations "https://github.com/camillepressense/pause_empathique/tree/main/users/migrations/"
    click unitTests "https://github.com/camillepressense/pause_empathique/blob/main/users/tests.py"
    click integrationTests "https://github.com/camillepressense/pause_empathique/tree/main/tests/"

    %% Styles
    classDef external fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef container fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFCC99,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef build fill:#E6E6FA,stroke:#333,stroke-width:1px
```
