# belloumi79/elearning_platform architecture

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

- Interactive diagram: https://gitdiagram.com/belloumi79/elearning_platform
- Repository: https://github.com/belloumi79/elearning_platform

## Overview

##### Project Components
- Project Type & Purpose: This is a Flask-based e-learning platform that offers secure authentication (via Supabase), an admin dashboard, course and student management, assignment/quiz handling, and real-time updates. The design should clearly capture both the server-side (backend) and client-side (frontend) components.
- Core Components:
- Web Application (Flask backend)
- API Routes and Controllers (located in app/routes/)
- Business Logic / Services (in app/services/)
- Data Models (in app/models/)
- Middleware for authentication (in app/middleware/)
- Database & Storage: PostgreSQL (via Supabase)
- Frontend: HTML templates in app/templates and static assets in app/static
- External Integrations: Supabase for authentication and possibly real-time features
- Utility/Administrative Scripts: Migration and setup files (e.g., supabase migrations, setup_admin.py)

##### File Structure
- The "app" folder is organized following the application factory pattern (app/__init__.py), with subdirectories for models, routes, services, middleware, templates, and static files.
- There is a clear separation of concerns:
- Routes (controllers) handle incoming HTTP requests and direct them to proper services.
- Services encapsulate business logic.
- Models define data structures for courses, users, students, instructors, and more.
- Middleware (e.g., auth.py) processes requests before passing them to the routes.
- Configuration directories (config/, .env, default.nix, etc.) indicate how the application is set up for different environments.
- Additional directories (e.g., functions) may host serverless functions, implying potential integration with cloud functions.
- The presence of static pages in “home/user/elearning_platform” might indicate landing pages or support for error pages.

##### Recommended Elements
- Each component and sub-component clearly labeled (e.g., “Flask Application (app/__init__.py)”, “Admin Routes (app/routes/admin.py)”, “Database Models (app/models/)”, “Authentication Middleware (app/middleware/auth.py)”).
- A small section or note to indicate the session management (using flask_session) and security measures (CSRF, JWT tokens).

##### Final Touches
- Major components and flows are clearly documented with labels.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    A("Client (Browser)"):::client

    %% Backend Layer
    subgraph "Backend Layer"
        B("Flask Application"):::backend
        C("API Routes & Controllers"):::backend
        D("Authentication Middleware"):::backend
        E("Business Logic / Services"):::backend
        F("Data Models"):::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        G1("Supabase Integration"):::database
        G2("User Schema"):::database
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        H("Frontend Templates"):::frontend
        I("Static Assets"):::frontend
    end

    %% External Services
    J("External: Supabase Auth"):::external

    %% Utility / Administrative Scripts
    subgraph "Utilities"
        K1("Setup Script"):::utility
        K2("Supabase Migrations"):::utility
    end

    %% Deployment & Containerization
    subgraph "Deployment & Containerization"
        M("Dockerfile"):::deploy
        N("Procfile"):::deploy
        O("Deployment Configs"):::deploy
    end

    %% Flow Connections
    A -->|"HTTP_request"| B
    B -->|"routes"| C
    C -->|"auth-check"| D
    D -->|"process_request"| E
    E -->|"business_logic"| F
    F -->|"DB_operations"| G1
    F -->|"DB_setup"| G2
    E -->|"auth_integration"| J
    B -->|"renders"| H
    B -->|"serves"| I
    %% Auxiliary flows for utilities and deployment
    B ---|"admin/setup"| K1
    K2 ---|"migrations"| B
    B ---|"deployment"| M
    B ---|"deployment"| N
    B ---|"deployment"| O
    H -->|"response"| A
    I -->|"assets"| A

    %% Click Events
    click B "https://github.com/belloumi79/elearning_platform/blob/master/app/__init__.py"
    click C "https://github.com/belloumi79/elearning_platform/tree/master/app/routes/"
    click D "https://github.com/belloumi79/elearning_platform/blob/master/app/middleware/auth.py"
    click E "https://github.com/belloumi79/elearning_platform/tree/master/app/services/"
    click F "https://github.com/belloumi79/elearning_platform/tree/master/app/models/"
    click G1 "https://github.com/belloumi79/elearning_platform/blob/master/app/database/supabase_db.py"
    click G2 "https://github.com/belloumi79/elearning_platform/blob/master/app/database/user_schema.sql"
    click H "https://github.com/belloumi79/elearning_platform/tree/master/app/templates/"
    click I "https://github.com/belloumi79/elearning_platform/tree/master/app/static/"
    click K1 "https://github.com/belloumi79/elearning_platform/blob/master/scripts/setup_admin.py"
    click K2 "https://github.com/belloumi79/elearning_platform/tree/master/supabase_migrations/"
    click M "https://github.com/belloumi79/elearning_platform/tree/master/Dockerfile"
    click N "https://github.com/belloumi79/elearning_platform/tree/master/Procfile"
    click O "https://github.com/belloumi79/elearning_platform/tree/master/config/"

    %% Styles
    classDef client fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef backend fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef database fill:#abebc6,stroke:#333,stroke-width:2px;
    classDef frontend fill:#f9d5e5,stroke:#333,stroke-width:2px;
    classDef external fill:#f7dc6f,stroke:#333,stroke-width:2px;
    classDef utility fill:#d2b4de,stroke:#333,stroke-width:2px;
    classDef deploy fill:#f5b7b1,stroke:#333,stroke-width:2px;
```
