# novati0n/moodle architecture

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

- Interactive diagram: https://gitdiagram.com/novati0n/moodle
- Repository: https://github.com/novati0n/moodle

## Overview

##### Main Components
- Frontend Components:
- The “public” directory holds all static resources (CSS, JavaScript, GLSL shaders, images, textures, and 3D models) and HTML templates (in “public/templates”).
- These assets are served to the user’s browser and are responsible for rendering the visualizations, including chart rendering and interactive 3D models.
- Backend Components:
- The “src” directory contains the Flask server code. Key files include “routes.py” for handling URL endpoints, “db.py” for database interactions, and “utils.py” for helper functionality.
- SQL scripts in “src/sql” indicate that the application initializes and updates a database (probably SQLite or similar) containing data about different cow visualizations (or “animaux” and related terminology).
- Database:
- The presence of multiple SQL scripts (for initialization, insertion, and updates) implies a structured relational database behind the scenes.
- Testing and Development:
- The “tests” directory contains unit tests that check the core functionalities of the app, ensuring the backend (and possibly some integration with the frontend) behaves as expected.
- Auxiliary/Work Files:
- The “work” directory contains blender projects, OBJ files, and conversion code, indicating that the tool incorporates 3D models developed in external tools which are then used for visualization.

##### Relationships and Interactions
- A client (web browser) sends HTTP requests to the Flask backend.
- The Flask application (in “src/routes.py”) processes these requests, interacts with the database (via “src/db.py”), and serves HTML templates located in “public/templates.”
- Static assets (stylesheets, JavaScript, shaders, images, 3D models) located in “public/static” are used by the HTML pages to render the eye-candy visualizations.
- The 3D models (created and stored in “work”) are converted as needed (see “work/obj-conv.cpp” and various OBJ files) and then served as static resources.
- CI/CD workflows (in “.github/workflows”) ensure the code quality and automated tests run on each commit.

##### Architectural Patterns and Design Principles
- MVC (or similar separation of concerns): The Flask routes (Controller) interact with HTML templates (View) and the database (Model).
- Layered architecture: There is a clear separation between frontend (visual/dynamic content) and backend (business logic and database management).
- Modularity: Different directories handle specific concerns (static files, server code, SQL initialization, and tests), promoting maintainability and scalability.

##### Relevant Technologies, Frameworks, and Libraries
- Python 3.10 (as per README instructions) is used for backend development along with the Flask framework.
- SQL databases managed by custom SQL scripts.
- Frontend technologies include HTML, CSS, JavaScript, and GLSL shaders for rendering effects and possibly interactive visualizations.
- Additional tools such as the “editorconfig-checker” and pre-commit hooks ensure code quality.

- Every essential element: front-end (static assets and templates), backend (Flask server, business logic, database connectivity), testing, and CI/CD integrations.
- Don’t hesitate to break down the backend further if needed, highlighting separate modules like routes, database operations, and utility functions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        F1["Browser/Client"]:::frontend
        F2["HTML Templates"]:::templates
        F3["Static Assets"]:::static
    end

    %% Backend Layer
    subgraph "Backend Layer"
        B1["Flask Server (routes.py)"]:::backend
        B2["Database Module (db.py)"]:::backend
        B3["Utility Functions (utils.py)"]:::backend
        B4["App Initialization (__init__.py)"]:::backend
        B5["WSGI Configuration (wsgi.py)"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        D1["Relational Database"]:::database
        D2["SQL Scripts"]:::database
    end

    %% Testing & Development
    subgraph "Testing & Development"
        T1["Testing Suite"]:::testing
    end

    %% Auxiliary Files
    subgraph "Auxiliary Files"
        A1["3D Models & Conversion"]:::aux
    end

    %% CI/CD Pipeline
    subgraph "CI/CD"
        C1["CI/CD Pipeline"]:::cicd
    end

    %% Connections between Frontend and Backend
    F2 -->|"RendersHTML"| F1
    F3 -->|"LoadsAssets"| F1
    F1 -->|"HTTPRequest/Response"| B1

    %% Backend internal interactions
    B1 -->|"Uses"| B2
    B1 -->|"Utilizes"| B3
    B4 -->|"Initializes"| B1
    B5 -->|"Configures"| B1

    %% Database interactions
    B2 -->|"ExecutesQueries"| D1
    B2 -->|"UsesSQL"| D2

    %% Testing and CI/CD interactions
    C1 -->|"RunsTests"| T1
    T1 -->|"Tests"| B1
    C1 -->|"Deploys"| B1

    %% Auxiliary files support static assets
    A1 -->|"Provides3DModels"| F3

    %% Click Events
    click F2 "https://github.com/novati0n/moodle/tree/main/public/templates"
    click F3 "https://github.com/novati0n/moodle/tree/main/public/static"
    click B1 "https://github.com/novati0n/moodle/blob/main/src/routes.py"
    click B2 "https://github.com/novati0n/moodle/blob/main/src/db.py"
    click B3 "https://github.com/novati0n/moodle/blob/main/src/utils.py"
    click B4 "https://github.com/novati0n/moodle/blob/main/src/__init__.py"
    click B5 "https://github.com/novati0n/moodle/blob/main/wsgi.py"
    click D2 "https://github.com/novati0n/moodle/tree/main/src/sql"
    click T1 "https://github.com/novati0n/moodle/tree/main/tests"
    click A1 "https://github.com/novati0n/moodle/tree/main/work"
    click C1 "https://github.com/novati0n/moodle/tree/main/.github/workflows"

    %% Styles
    classDef frontend fill:#ffe6e6,stroke:#990000,stroke-width:2px;
    classDef templates fill:#fff2cc,stroke:#996600,stroke-width:2px;
    classDef static fill:#e6f7ff,stroke:#006699,stroke-width:2px;
    classDef backend fill:#e6ffe6,stroke:#009900,stroke-width:2px;
    classDef database fill:#e6f2ff,stroke:#003399,stroke-width:2px;
    classDef testing fill:#ffffe6,stroke:#999900,stroke-width:2px;
    classDef cicd fill:#fff0e6,stroke:#cc6600,stroke-width:2px;
    classDef aux fill:#e6f9ff,stroke:#006666,stroke-width:2px;
```
