# ngocanhit201/dpo architecture

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

- Interactive diagram: https://gitdiagram.com/ngocanhit201/dpo
- Repository: https://github.com/ngocanhit201/dpo

## Overview

##### Project type and purpose
- This is a full-stack web application for managing school administrative procedures.
- Frontend: React + Next.js + MUI + Tailwind CSS
- Backend: C# ASP.NET Core 8 with JWT authentication and EF Core for SQL Server
- Purpose: Allow students to view and submit procedure requests, and allow faculty/staff to review, approve, or reject them, with file uploads and tracking of workflow.

##### File structure
- Top-level directories:
- DPO_FE – the Next.js React UI
- DPO_BE – the ASP.NET Core Web API / MVC backend
- FE patterns:
- src/app – Next.js “app router” pages & layouts (blank and main layouts for student/teacher)
- src/components, @core, @menu, @layouts – UI component libraries & themes
- src/api – client-side API calls (Axios wrappers)
- BE patterns:
- Controllers (AuthController, CasesController, etc.) implementing REST endpoints
- Areas/Files – MVC area for file management using elFinder
- Models + DbContext (StudentProceduresOnlineContext) using EF Core
- Mapper folder with DTOs & AutoMapper profiles
- Utils (mail settings, constants)
- appsettings.json – configuration for DB, JWT, SMTP
- wwwroot/Uploads – static file store for attachments
- Deployment/config:
- DPO_FE/.env.example, next.config.mjs – frontend environment & build
- DPO_BE/Program.cs, launchSettings.json – backend startup & launch profiles

##### Key README insights
- Describes two user flows: student side and staff side
- Emphasizes JWT auth, file attachments, workflow tracking, SQL Server

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser
    Browser["Browser (Student/Staff UI)"]:::external

    %% Frontend Layer
    subgraph "Next.js Frontend" 
        direction TB
        AppRouter["src/app<br/>(Page Routing & Layouts)"]:::frontend
        API_Module["src/api<br/>(API Module)"]:::frontend
        AxiosWrapper["src/utils/MyAxios.ts"]:::frontend
        Components["src/components<br/>(Shared React Components)"]:::frontend
        Core["src/@core<br/>(MUI Components & Theme)"]:::frontend
        Layouts["src/@layouts<br/>(Blank/Horizontal/VerticalLayouts)"]:::frontend
        Menu["src/@menu<br/>(Navigation Menus & Contexts)"]:::frontend
        Env[".env.example"]:::frontend
        Config["next.config.mjs"]:::frontend
    end

    %% Backend Layer
    subgraph "ASP.NET Core Backend API"
        direction TB
        Controllers["DPO_BE/Controllers<br/>(Auth, Cases, Procedures)"]:::backend
        AreasFiles["DPO_BE/Areas/Files<br/>(FileManager Area)"]:::backend
        Program["DPO_BE/Program.cs<br/>(Startup & Middleware)"]:::backend
        Launch["DPO_BE/Properties/launchSettings.json"]:::backend
        AppSettings["DPO_BE/appsettings.json<br/>& appsettings.Development.json"]:::backend
        Models["DPO_BE/Models<br/>(EF Core Models & DbContext)"]:::backend
        MapperLayer["DPO_BE/Mapper<br/>(DTOs & MappingProfile)"]:::backend
        Utils["DPO_BE/Utils<br/>(Constants, MailSettings, Helpers)"]:::backend
        Uploads["DPO_BE/wwwroot/Uploads<br/>(Static File Store)"]:::gray
        Elfinder["DPO_BE/wwwroot/lib/elfinder<br/>(elFinder JS Library)"]:::gray
    end

    %% External Services
    SQLServer["SQL Server Database"]:::external
    SMTP["SMTP Email Service"]:::external

    %% Connections
    Browser -->|"HTTP(S) UI Requests"| AppRouter
    AppRouter -->|"API Calls with JWT"| API_Module
    API_Module -->|"Uses Axios Wrapper"| AxiosWrapper
    API_Module -->|"Calls Backend REST API"| Controllers
    Controllers -->|"EF Core Queries"| Models
    Controllers -->|"File Upload/Download"| Uploads
    AreasFiles -->|"Uses elFinder UI"| Elfinder
    Controllers -->|"Send Emails"| SMTP
    Controllers -->|"Issue Token / Validate JWT"| Utils
    Controllers -->|"Mapping DTOs"<br/>""| MapperLayer
    Utils -->|"Mail Settings from Config"| AppSettings
    Models -->|"Connect"| SQLServer

    %% Click Events
    click AppRouter "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/app"
    click API_Module "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/api"
    click AxiosWrapper "https://github.com/ngocanhit201/dpo/blob/main/DPO_FE/src/utils/MyAxios.ts"
    click Components "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/components"
    click Core "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/@core"
    click Layouts "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/@layouts"
    click Menu "https://github.com/ngocanhit201/dpo/tree/main/DPO_FE/src/@menu"
    click Env "https://github.com/ngocanhit201/dpo/blob/main/DPO_FE/.env.example"
    click Config "https://github.com/ngocanhit201/dpo/blob/main/DPO_FE/next.config.mjs"
    click Controllers "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/Controllers"
    click AreasFiles "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/Areas/Files"
    click Program "https://github.com/ngocanhit201/dpo/blob/main/DPO_BE/Program.cs"
    click Launch "https://github.com/ngocanhit201/dpo/blob/main/DPO_BE/Properties/launchSettings.json"
    click AppSettings "https://github.com/ngocanhit201/dpo/blob/main/DPO_BE/appsettings.json"
    click Models "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/Models"
    click MapperLayer "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/Mapper"
    click Utils "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/Utils"
    click Uploads "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/wwwroot/Uploads"
    click Elfinder "https://github.com/ngocanhit201/dpo/tree/main/DPO_BE/wwwroot/lib/elfinder"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef backend fill:#E0FFE0,stroke:#28A745,color:#28A745;
    classDef external fill:#FFF3CD,stroke:#FF8C00,color:#FF8C00;
    classDef gray fill:#F0F0F0,stroke:#AAAAAA,color:#333333;
```
