# manhhuyen2944/webbaigiang_ckc architecture

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

- Interactive diagram: https://gitdiagram.com/manhhuyen2944/webbaigiang_ckc
- Repository: https://github.com/manhhuyen2944/webbaigiang_ckc

## Overview

##### Relationships & data flows
a. Public Area
b. Admin Area (under /Areas/Admin)
- Controllers in each area routing to:
- Razor Views (cshtml under Views or Areas/Admin/Views)
- Partial Views (_Header, _Footer, Layouts)
- DbContext → Database (SQL)
- Services/Helpers also call File Storage (UpLoads) for file import/export.
- Web Server serving static assets from wwwroot to Browser (CSS, JS, images).
- NPM/LibMan packages under wwwroot/lib and node_modules.

##### Architectural patterns & principles
- MVC: Controllers → Models → Views.
- Area segregation: Admin vs. Public.
- EF Core Code-First Migrations (Migrations folder).
- Single-instance Web App hosting both UI and API endpoints.
- File Storage as a “mini” micro-service (on disk).

##### Relevant tech stacks
- ASP.NET Core 6.0
- Entity Framework Core
- SQL Server (or configured RDBMS)
- Razor view engine
- JavaScript: jQuery, Bootstrap, ElFinder (file manager), Summernote (WYSIWYG), ToastNotification

## Diagram (Mermaid)

```mermaid
flowchart TB
    classDef client fill:#FFD700,stroke:#333,stroke-width:1px
    classDef compute fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef storage fill:#90EE90,stroke:#333,stroke-width:1px
    classDef boundary stroke-dasharray: 5 5,stroke:#666

    Browser["Browser"]:::client
    StaticServer["Static-File Server\n(wwwroot, lib, node_modules)"]:::compute
    click StaticServer "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/wwwroot/"

    subgraph "ASP.NET Core MVC App" 
        direction TB
        WebServer["Web Server\n(ASP.NET Core MVC)"]:::compute
        click WebServer "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/Program.cs"
        click WebServer "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/appsettings.json"
        click WebServer "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/appsettings.Development.json"

        subgraph "Public Area" 
            direction TB
            PubRouting["Routing"]:::compute
            PubControllers["Controllers"]:::compute
            click PubControllers "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/Controllers/"
            RazorEngPub["Razor View Engine"]:::compute
            PubViews["Views & Partials"]:::compute
            click PubViews "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/Views/"
        end

        subgraph "Admin Area" 
            direction TB
            AdminRouting["Routing"]:::compute
            AdminControllers["Controllers"]:::compute
            click AdminControllers "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/Areas/Admin/Controllers/"
            RazorEngAdm["Razor View Engine"]:::compute
            AdminViews["Views & Partials"]:::compute
            click AdminViews "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/Areas/Admin/Views/"
        end

        Services["Services & Helpers"]:::compute
        click Services "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/Extension/HashMD5.cs"
        click Services "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/Helper/Utilities.cs"
        DbContext["DbContext / EF Core"]:::compute
        click DbContext "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/Data/WebBaiGiangContext.cs"
        Migrations["Migrations"]:::compute
        click Migrations "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/Migrations/"
    end

    Database["SQL Database"]:::storage
    FileStorage["File Storage\n(UpLoads)"]:::storage
    click FileStorage "https://github.com/manhhuyen2944/webbaigiang_ckc/tree/main/WebBaiGiang_CKC/UpLoads/"

    ExternalLibs["External JS/CSS Libraries\njQuery, Bootstrap,\nElFinder, Summernote,\nToastNotification"]:::compute
    click ExternalLibs "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/WebBaiGiang_CKC/libman.json"
    NodePackages["Node/NPM Packages"]:::compute
    click NodePackages "https://github.com/manhhuyen2944/webbaigiang_ckc/blob/main/package.json"

    %% Flows
    Browser -->|"HTTP GET/POST"| WebServer
    Browser -->|"serves assets"| StaticServer
    StaticServer -->|"delivers assets"| Browser

    WebServer -->|"reads configs"| WebServer
    WebServer -->|"uses"| PubRouting
    WebServer -->|"uses"| AdminRouting

    PubRouting -->|"routes to"| PubControllers
    PubControllers -->|"renders via"| RazorEngPub
    RazorEngPub -->|"loads"| PubViews

    AdminRouting -->|"routes to"| AdminControllers
    AdminControllers -->|"renders via"| RazorEngAdm
    RazorEngAdm -->|"loads"| AdminViews

    PubControllers -->|"calls"| Services
    AdminControllers -->|"calls"| Services

    Services -->|"uses"| DbContext
    Services -->|"reads/writes"| FileStorage

    DbContext -->|"migrates"| Migrations
    DbContext -->|"CRUD operations"| Database

    ExternalLibs --> StaticServer
    NodePackages --> StaticServer

    %% Styles
    class Browser client
    class StaticServer compute
    class WebServer compute
    class PubRouting,PubControllers,RazorEngPub,PubViews,AdminRouting,AdminControllers,RazorEngAdm,AdminViews,Services,DbContext,Migrations compute
    class Database,FileStorage storage
    class ExternalLibs,NodePackages compute
```
