# antonyrichard29/elearning-platform architecture

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

- Interactive diagram: https://gitdiagram.com/antonyrichard29/elearning-platform
- Repository: https://github.com/antonyrichard29/elearning-platform

## Overview

##### Main Components

A. Frontend Layer:
- Thymeleaf Templates (located in /templates)
- Static Resources (CSS files in /static/css)
- Different views: home, login, register, course-related pages

B. Backend Layer:
- Controllers Package (REST endpoints and view controllers)
- Services Layer (business logic)
- Repositories Layer (data access)
- Entities (domain models)

C. Database Layer:
- MySQL Database

**[Client Browser] → [Frontend Layer] → [Backend Layer] → [Database Layer]**

**┌─ Views (Thymeleaf) ─────────┐**
- Home View                 │
- Course Views             │
- User Management Views    │
- Static Resources (CSS)   │
- ┘

**┌─ Controllers ──────┐  ┌─ Services ────────┐  ┌─ Repositories ────┐**
- NavController   │→ │ - UserService     │→ │ - UserRepository │
- UserController  │  │ - CourseService   │  │ - CourseRepository│
- CourseController│  │ - TrainerService  │  └──────────────────┘
- ┘  └─────────────────────┘

##### Key Relationships to Highlight

- User Authentication Flow:
- Login/Register pages → UsersController → UsersService → UsersRepository → Database

- Course Management Flow:
- Course pages → CourseController → TrainerService/StudentService → CourseRepository → Database

##### Additional Elements

- A note about YouTube integration
- Role-based access control (Student vs Trainer paths)
- Spring Boot application context
- Where security configurations apply

##### Implementation Details

- Spring Boot Application Context
- MySQL Database Connection
- Thymeleaf Template Engine
- Static Resource Handling
- Service Layer Implementations
- Repository Interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    Client(("Client Browser")):::client

    %% Frontend Layer
    subgraph Frontend
        Templates["Thymeleaf Templates"]:::frontend
        StaticRes["Static Resources"]:::frontend
        HomeView["Home View"]:::frontend
        CourseView["Course Views"]:::frontend
        UserView["User Management Views"]:::frontend
    end

    %% Backend Layer
    subgraph Controllers
        NavCtrl["Navigation Controller"]:::controller
        UserCtrl["Users Controller"]:::controller
        StudentCtrl["Student Controller"]:::controller
        TrainerCtrl["Trainer Controller"]:::controller
    end

    subgraph Services
        UserSvc["Users Service"]:::service
        StudentSvc["Student Service"]:::service
        TrainerSvc["Trainer Service"]:::service
    end

    subgraph Repositories
        UserRepo["Users Repository"]:::repository
        CourseRepo["Course Repository"]:::repository
    end

    subgraph Entities
        UserEntity["Users Entity"]:::entity
        CourseEntity["Course Entity"]:::entity
    end

    %% Database Layer
    DB[(MySQL Database)]:::database

    %% Relationships
    Client --> Templates
    Templates --> StaticRes
    Templates --> HomeView
    Templates --> CourseView
    Templates --> UserView

    HomeView --> NavCtrl
    UserView --> UserCtrl
    CourseView --> StudentCtrl
    CourseView --> TrainerCtrl

    NavCtrl --> UserSvc
    UserCtrl --> UserSvc
    StudentCtrl --> StudentSvc
    TrainerCtrl --> TrainerSvc

    UserSvc --> UserRepo
    StudentSvc --> CourseRepo
    TrainerSvc --> CourseRepo

    UserRepo --> UserEntity
    CourseRepo --> CourseEntity

    UserEntity --> DB
    CourseEntity --> DB

    %% Click Events
    click Templates "https://github.com/antonyrichard29/elearning-platform/tree/main/src/main/resources/templates/"
    click StaticRes "https://github.com/antonyrichard29/elearning-platform/tree/main/src/main/resources/static/css/"
    click NavCtrl "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/controller/NavController.java"
    click UserCtrl "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/controller/UsersController.java"
    click StudentCtrl "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/controller/StudentController.java"
    click TrainerCtrl "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/controller/TrainerController.java"
    click UserSvc "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/services/UsersService.java"
    click StudentSvc "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/services/StudentService.java"
    click TrainerSvc "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/services/TrainerService.java"
    click UserRepo "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/repositories/UsersRepository.java"
    click CourseRepo "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/repositories/CourseRepository.java"
    click UserEntity "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/entities/Users.java"
    click CourseEntity "https://github.com/antonyrichard29/elearning-platform/blob/main/src/main/java/antoEP/ElearningPlatform/entities/Course.java"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef frontend fill:#bbf,stroke:#333,stroke-width:1px
    classDef controller fill:#bfb,stroke:#333,stroke-width:1px
    classDef service fill:#fbf,stroke:#333,stroke-width:1px
    classDef repository fill:#fbb,stroke:#333,stroke-width:1px
    classDef entity fill:#bff,stroke:#333,stroke-width:1px
    classDef database fill:#ff9,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        Client2(("Client")):::client
        Frontend2["Frontend"]:::frontend
        Controller2["Controller"]:::controller
        Service2["Service"]:::service
        Repository2["Repository"]:::repository
        Entity2["Entity"]:::entity
        Database2[(Database)]:::database
    end
```
