# hophihung/educationcentermanagement architecture

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

- Interactive diagram: https://gitdiagram.com/hophihung/educationcentermanagement
- Repository: https://github.com/hophihung/educationcentermanagement

## Overview

##### Project Overview
- This is a full-stack application designed to manage different aspects of an education center (e.g., courses, classes, payments, attendance, teachers, and students).
- The project is organized into three major directories:
- The backend (built with NodeJS using NestJS and organized by domain modules).
- The frontend (built with ReactJS, with dedicated pages and components for admins, teachers, and students).
- The database (using JSON files for data dumping, intended to interface with a MongoDB-like storage).

##### Identifying Main Components
- Frontend Service:
- Built with ReactJS.
- Contains separate modules for admin, teacher, and student views.
- Key directories: src/components, src/pages, src/assets, src/services, etc.
- Backend Service:
- A NodeJS (NestJS) application with a modular structure.
- Organized by domains (for example, Auth, Courses, Classes, Payments, Attendances, Centers, etc.) following an MVC-like pattern.
- Contains dedicated controllers, services, DTOs, and configuration files to handle domain-specific logic.
- Database:
- Simulated via JSON files used for dumping data (files in the ‘database’ directory).
- Mentioned technology is MongoDB, meaning the backend likely interacts with a MongoDB instance.
- CI/CD and Deployment:
- GitHub workflows specified (for build, commit message validation, branch validation) that automate frontend and backend builds and publish Docker images.
- Docker containerization indicated via Dockerfiles, docker-compose.yml, and proxy configuration (nginx in the proxy directory).

##### Relationships and Interactions
- The Frontend communicates with the Backend via RESTful APIs.
- The Backend’s domain modules work independently but may share services/components (authentication, configuration, middlewares, and utility components).
- The Database acts as persistent storage, interfaced by the backend’s data access layers (possibly using ODM or similar pattern).
- External integrations (payment gateways like Momo and Zalopay) are encapsulated in their specific domains creating third-party interactions.
- CI/CD components (workflows, Docker, proxy server, etc.) automate the build, test, and deployment pipeline.

##### Architectural Patterns and Design Principles
- Modular Architecture: The backend is clearly segmented into domains (admin, auth, payments, attendances, etc.) using a decoupled module system.
- MVC Pattern: In many domains, controllers serve HTTP requests, delegate processing to services, and use DTOs for data transfer.
- Separation of Concerns: Frontend, backend, and database are isolated by responsibilities.
- Containerization and CI/CD: Use of Docker, docker-compose, and GitHub workflows illustrate continuous integration and deployment.

##### Relevant Technologies and Frameworks
- Backend: NodeJS, NestJS, TypeScript, Docker.
- Frontend: ReactJS, TypeScript, Vite (for building the frontend bundle), and a range of styling and utility libraries.
- Database: JSON-based files (with an intended MongoDB integration).
- Infrastructure: GitHub Actions for CI/CD, Nginx for reverse proxy (as seen in the proxy directory), and Docker for containerization.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Service
    subgraph "Frontend Service"
        FE1("ReactJS Frontend"):::frontend
        FE2("Admin/Teacher/Student Pages"):::frontend
        FE3("Components & Services"):::frontend
    end

    %% Backend Service
    subgraph "Backend Service"
        BE1("NestJS Backend"):::backend
        subgraph "Domain Modules"
            BE2("Auth Module"):::backend
            BE3("Courses Module"):::backend
            BE4("Classes Module"):::backend
            BE5("Payments Module"):::backend
            BE6("Attendances Module"):::backend
            BE7("Centers Module"):::backend
        end
        BE8("Middlewares & Configuration"):::backend
    end

    %% Database
    subgraph "Database"
        DB1("MongoDB/JSON Storage"):::database
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        CICD1("GitHub Workflows"):::cicd
        CICD2("Docker & Build Files"):::cicd
    end

    %% Reverse Proxy
    subgraph "Reverse Proxy"
        RP1("Nginx Proxy"):::proxy
    end

    %% Relationships and Data Flow
    FE1 -->|"RESTfulAPI"| BE1
    FE2 -->|"UserInterface"| FE1
    FE3 -->|"SupportCalls"| FE1

    BE1 -->|"HandlesRequests"| BE2
    BE1 -->|"HandlesRequests"| BE3
    BE1 -->|"HandlesRequests"| BE4
    BE1 -->|"HandlesRequests"| BE5
    BE1 -->|"HandlesRequests"| BE6
    BE1 -->|"HandlesRequests"| BE7
    BE1 -->|"Utilizes"| BE8

    BE1 -->|"DataPersistence"| DB1
    BE5 -->|"ExternalAPICall"| BE1

    CICD1 -->|"TriggerFrontendBuild"| FE1
    CICD1 -->|"TriggerBackendBuild"| BE1
    CICD2 -->|"ContainerizeApp"| BE1

    RP1 -->|"RoutesTraffic"| BE1

    %% Click Events for Component Mapping
    click FE1 "https://github.com/hophihung/educationcentermanagement/tree/main/frontend/"
    click FE2 "https://github.com/hophihung/educationcentermanagement/tree/main/frontend/src/pages"
    click FE3 "https://github.com/hophihung/educationcentermanagement/tree/main/frontend/src/components"
    click BE1 "https://github.com/hophihung/educationcentermanagement/tree/main/backend/"
    click BE2 "https://github.com/hophihung/educationcentermanagement/tree/main/backend/src/domains"
    click CICD1 "https://github.com/hophihung/educationcentermanagement/tree/main/.github/workflows/"
    click CICD2 "https://github.com/hophihung/educationcentermanagement/tree/main/backend/Dockerfile"
    click CICD2 "https://github.com/hophihung/educationcentermanagement/blob/main/docker-compose.yml"
    click DB1 "https://github.com/hophihung/educationcentermanagement/tree/main/database/"
    click RP1 "https://github.com/hophihung/educationcentermanagement/blob/main/proxy/nginx.conf"

    %% Styles
    classDef frontend fill:#FFEEAD,stroke:#333,stroke-width:2px;
    classDef backend fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef database fill:#C3FDB8,stroke:#333,stroke-width:2px;
    classDef cicd fill:#F7C6E7,stroke:#333,stroke-width:2px;
    classDef proxy fill:#FAD4D4,stroke:#333,stroke-width:2px;
```
