# olivervinh/do-an-tot-nghiep architecture

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

- Interactive diagram: https://gitdiagram.com/olivervinh/do-an-tot-nghiep
- Repository: https://github.com/olivervinh/do-an-tot-nghiep

## Overview

##### Main Components
- Backend API Server: The “API” folder is an ASP.NET Core Web API project built in C#. It contains controllers for handling various business functions (accounts, authentication, blogs, carts, orders, notifications, etc.), along with data access via Entity Framework (see Data, DPContext, SeedData, and the presence of packages for EntityFramework) and helper functionalities including JWT-based authentication (JwtFactory, JwtIssuerOptions) and SignalR for real-time communications.
- Admin Application: The “AdminApp” directory is an Angular-based admin dashboard that likely provides functionalities for managing products, orders, users, and other administrative tasks.
- Client Application: The “ClientApp” directory is also an Angular project, serving as the customer-facing website for browsing products, checkout process, user account management, etc.
- Database: Although it is not visible as a separate service in the file tree, the SQL folder (with DoAnTotNghiep.sql) implies a relational database (probably SQL Server) used by the backend.
- Supporting Assets: There is a “Doc” folder (for documentation) and additional assets like images and configurations that support both the API (wwwroot) and the frontend clients.

##### Relationships and Data Flows
- SignalR “hubs” in the API (for example, BroadcastHub) suggest real-time data push (possibly for notifications or live updates), so indicate that as a subcomponent/process inside the backend.
- The API uses JWT authentication and middleware for error handling (ExceptionMiddleware) and validations, which should be noted as important design patterns inside the API component.

##### Architectural Patterns and Technologies
- MVC Pattern: The API leverages Controllers and Views (for PDF generation using cshtml views) in an MVC style, even if it’s a REST API.
- Separation of Concerns: Distinct projects for Admin and Client front-ends, implying clear separation of responsibilities and UI roles.
- Technology Stack:
– Backend: C#, ASP.NET Core, Entity Framework, SignalR, JWT.
– Frontend: Angular (two separate apps), with Angular’s routing modules, components, services, and assets.
– Database: Likely SQL Server (with connection settings defined in appsettings.json files and the SQL scripts provided).
- The use of DTOs (Data Transfer Objects) in the API suggests a layered design to isolate the business models from how data is exchanged with clients.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Applications"
        clientApp["ClientApp - Angular Customer Interface"]:::frontend
        adminApp["AdminApp - Angular Admin Dashboard"]:::frontend
    end

    subgraph "Backend Services"
        apiServer["Backend API Server (ASP.NET Core)"]:::backend
        subgraph "Internal API Components"
            controllers["Controllers (Accounts,Auth,Blogs,Carts,Orders,Notifications)"]:::backend
            dataAccess["Entity Framework (DPContext, SeedData)"]:::backend
            middleware["Middleware (JWTAuth,ExceptionMiddleware)"]:::backend
            signalr["SignalR Hub (Real-time Notifications)"]:::backend
        end
        apiServer --> controllers
        apiServer --> dataAccess
        apiServer --> middleware
        apiServer --> signalr
    end

    database["Database (SQL Server)"]:::database

    subgraph "Supporting Assets & Documentation"
        assets["API Static Assets (wwwroot)"]:::assets
        docs["Project Documentation (Đồ án tốt nghiệp)"]:::assets
    end

    clientApp -->|"HTTP"| apiServer
    adminApp -->|"HTTP"| apiServer
    apiServer -->|"EntityFramework"| database
    signalr -->|"Real-time"| clientApp
    signalr -->|"Real-time"| adminApp

    apiServer --- assets
    apiServer --- docs

    click apiServer "https://github.com/olivervinh/do-an-tot-nghiep/tree/master/API/API"
    click adminApp "https://github.com/olivervinh/do-an-tot-nghiep/tree/master/AdminApp"
    click clientApp "https://github.com/olivervinh/do-an-tot-nghiep/tree/master/ClientApp"
    click database "https://github.com/olivervinh/do-an-tot-nghiep/blob/master/Sql/DoAnTotNghiep.sql"
    click assets "https://github.com/olivervinh/do-an-tot-nghiep/tree/master/API/API/wwwroot"
    click docs "https://github.com/olivervinh/do-an-tot-nghiep/blob/master/Doc/Đồ án tốt nghiệp.docx"

    classDef frontend fill:#A7D7C5,stroke:#333,stroke-width:2px;
    classDef backend fill:#F7CAC9,stroke:#333,stroke-width:2px;
    classDef database fill:#C9CBA3,stroke:#333,stroke-width:2px;
    classDef assets fill:#FFEB99,stroke:#333,stroke-width:2px;
```
