# absievil/hcmut_ssps architecture

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

- Interactive diagram: https://gitdiagram.com/absievil/hcmut_ssps
- Repository: https://github.com/absievil/hcmut_ssps

## Overview

##### Main Components
- Frontend: This is the React application (found under “frontend-react”). It includes UI components, state management (store), routing (including login, register, dashboard, payment pages, etc.), and styling layers.
- Backend: The Spring Boot application (under “backend-springboot”) which contains controllers (RESTful endpoints for Admin, Student, Utilities, etc.), data transfer objects (DTOs), models, services (including email, payment, and utilities), security classes (JWT, OAuth2, etc.), and database configuration files.
- Database: The PostgreSQL database (as indicated in the README and supported by SQL scripts inside the backend’s resources folder).
- External Services: Payment integration via VNPAY configuration, and email services.

##### Understand the Interactions and Relationships
- The Backend orchestrates operations such as user authentication, payment processing, and data management. It makes use of various layers (e.g., Controllers → Services → Repositories → Database) which should be explicitly represented.
- Security: Include components such as JwtAuthenticationFilter, CustomUserDetailsService, and OAuth2LoginSuccessHandler, which mediate authentication and authorization.

##### Architectural Patterns and Design Principles
- MVC (Model-View-Controller): The backend clearly separates concerns between Controllers, Services, and Models.
- RESTful API Design: Display REST endpoints and the pattern of requests/responses.
- Layered Architecture: Frontend → API Gateway → Business Logic (Backend Services) → Data Access.
- Security: JWT-based authentication, OAuth2 integration, and role management using “Role” and “User” models.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["React App (Vite, Tailwind CSS)"]
    end

    %% Backend Layer
    subgraph "Backend Layer"
        subgraph "Controllers"
            RC["REST Controllers (Admin,Student,Payment, etc.)"]
        end
        subgraph "Business Logic"
            SL["Service Layer (Email,Payment,Utilities)"]
            DM["Domain Models (User,Role, etc.)"]
            DTO["Data Transfer Objects (DTOs)"]
            SEC["Security Components (JWT,OAuth2)"]
            PI["Payment Integration (VNPAY)"]
        end
    end

    %% Database Layer
    subgraph "Database Layer"
        DB["PostgreSQL Database"]
    end

    %% External Services
    subgraph "External Services"
        ES1["Payment Gateway (VNPAY)"]
        ES2["Email Sender"]
    end

    %% Documentation
    subgraph "Documentation"
        DOC["System Documentation (Diagrams)"]
    end

    %% Connections
    FE -->|"REST_API_calls"| RC
    RC -->|"invokes"| SL
    RC -->|"auth_checks"| SEC
    SL -->|"processes"| DM
    SL -->|"transfers"| DTO
    SL -->|"invokes"| PI
    SL -->|"accesses"| DB
    SL -->|"triggers_payment"| ES1
    SL -->|"sends_emails"| ES2

    %% Click Events
    click FE "https://github.com/absievil/hcmut_ssps/tree/master/frontend-react"
    click RC "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/Controllers"
    click DTO "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/DTO"
    click DM "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/Models"
    click SL "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/Services"
    click SEC "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/Securities"
    click PI "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/java/hcmut/hcmut_spss/PaymentConfig"
    click DB "https://github.com/absievil/hcmut_ssps/tree/master/backend-springboot/src/main/resources/db"
    click DOC "https://github.com/absievil/hcmut_ssps/tree/master/HCMUT_SSPS Docs"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef db fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef documentation fill:#e2e3e5,stroke:#333,stroke-width:2px;

    class FE frontend;
    class RC,SL,DM,DTO,SEC,PI backend;
    class DB db;
    class ES1,ES2 external;
    class DOC documentation;
```
