# tamht298/final-project architecture

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

- Interactive diagram: https://gitdiagram.com/tamht298/final-project
- Repository: https://github.com/tamht298/final-project

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Client Layer:
- Angular 9 Frontend (User Interface)
- Admin Module
- User Module
- Shared Components

b) Server Layer:
- Spring Boot Backend
- REST Controllers
- Service Layer
- Repository Layer

c) Database Layer:
- MySQL Database

d) External Services:
- Email Service
- AWS S3 (for file storage)

**┌─ Angular Frontend ─────────────────────┐**
- Admin Module                        │
- Dashboard                        │
- User Management                  │
- Course Management               │
- Exam Management                 │
- User Module                         │
- Exam Taking                      │
- Results View                     │
- Schedule View                    │
- Shared Components                   │
- ┬────────────────────┘
- ↓

**┌─ Spring Boot Backend ─────────────────┐**
- Controllers                        │
- Auth Controller                 │
- Exam Controller                 │
- User Controller                 │
- Course Controller               │
- Services                           │
- Repositories                       │
- Security (JWT)                     │
- ┬───────────────────┘
- ↓

**┌─ Storage ────────────────────────────┐**
- MySQL Database                    │
- AWS S3 Storage                    │
- ┘

##### Key Elements to Highlight

- Security Layer: JWT Authentication
- File Handling: AWS S3 integration
- Email Service: Password reset functionality
- Real-time Components: Exam processing
- Data Flow: Question bank to exam delivery

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[Angular Frontend]
        AdminMod[Admin Module]:::frontend
        UserMod[User Module]:::frontend
        SharedComp[Shared Components]:::frontend
        AuthGuard[Auth Guard]:::security
        AuthService[Auth Service]:::security
        Models[Frontend Models/DTOs]:::frontend

        UI --> AdminMod
        UI --> UserMod
        UI --> SharedComp
        UI --> AuthGuard
        UI --> AuthService
        UI --> Models

        subgraph AdminFeatures
            Dashboard[Dashboard]:::frontend
            UserMgmt[User Management]:::frontend
            CourseMgmt[Course Management]:::frontend
            ExamMgmt[Exam Management]:::frontend

            AdminMod --> Dashboard
            AdminMod --> UserMgmt
            AdminMod --> CourseMgmt
            AdminMod --> ExamMgmt
        end

        subgraph UserFeatures
            ExamTaking[Exam Taking]:::frontend
            ResultsView[Results View]:::frontend
            ScheduleView[Schedule View]:::frontend

            UserMod --> ExamTaking
            UserMod --> ResultsView
            UserMod --> ScheduleView
        end
    end

    subgraph Backend
        SpringBoot[Spring Boot Backend]
        Controllers[Controllers]:::backend
        Services[Services]:::backend
        Repos[Repositories]:::backend
        JWTConfig[JWT Utils]:::security
        SecurityConfig[Security Config]:::security
        Entities[Backend Entities]:::backend

        SpringBoot --> Controllers
        Controllers --> Services
        Services --> Repos
        SpringBoot --> JWTConfig
        SpringBoot --> SecurityConfig
        Repos --> Entities

        subgraph BackendControllers
            AuthController[Auth Controller]:::backend
            ExamController[Exam Controller]:::backend
            UserController[User Controller]:::backend
            CourseController[Course Controller]:::backend
            EmailController[Email Controller]:::backend

            Controllers --> AuthController
            Controllers --> ExamController
            Controllers --> UserController
            Controllers --> CourseController
            Controllers --> EmailController
        end
    end

    subgraph Storage
        MySQL[(MySQL Database)]:::database
        S3[AWS S3 Storage]:::external
        S3Config[S3 Configuration]:::external
    end

    UI -- REST API --> Controllers
    Repos -- Database Operations --> MySQL
    Services -- File Operations --> S3
    SpringBoot --> S3Config

    classDef frontend fill:#3498db
    classDef backend fill:#2ecc71
    classDef database fill:#e67e22
    classDef security fill:#e74c3c
    classDef external fill:#9b59b6

    click AdminMod "https://github.com/tamht298/final-project/tree/master/source code/front-end-user/src/app/admin"
    click UserMod "https://github.com/tamht298/final-project/tree/master/source code/front-end-user/src/app/user"
    click SharedComp "https://github.com/tamht298/final-project/tree/master/source code/front-end-user/src/app/shared"
    click AuthService "https://github.com/tamht298/final-project/blob/master/source code/front-end-user/src/app/_services/auth.service.ts"
    click Controllers "https://github.com/tamht298/final-project/tree/master/source code/backend/src/main/java/com/thanhtam/backend/controller"
    click Services "https://github.com/tamht298/final-project/tree/master/source code/backend/src/main/java/com/thanhtam/backend/service"
    click Repos "https://github.com/tamht298/final-project/tree/master/source code/backend/src/main/java/com/thanhtam/backend/repository"
    click JWTConfig "https://github.com/tamht298/final-project/blob/master/source code/backend/src/main/java/com/thanhtam/backend/config/JwtUtils.java"
    click S3Config "https://github.com/tamht298/final-project/blob/master/source code/backend/src/main/java/com/thanhtam/backend/config/S3Config.java"
    click EmailController "https://github.com/tamht298/final-project/blob/master/source code/backend/src/main/java/com/thanhtam/backend/controller/EmailController.java"
    click MySQL "https://github.com/tamht298/final-project/blob/master/source code/backend/src/main/resources/application.properties"
    click Models "https://github.com/tamht298/final-project/tree/master/source code/front-end-user/src/app/models"
    click Entities "https://github.com/tamht298/final-project/tree/master/source code/backend/src/main/java/com/thanhtam/backend/entity"
    click AuthGuard "https://github.com/tamht298/final-project/blob/master/source code/front-end-user/src/app/_guards/auth-guard.guard.ts"
    click SecurityConfig "https://github.com/tamht298/final-project/blob/master/source code/backend/src/main/java/com/thanhtam/backend/config/WebSecurityConfig.java"
```
