# ttnghia-vaino/gomsu architecture

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

- Interactive diagram: https://gitdiagram.com/ttnghia-vaino/gomsu
- Repository: https://github.com/ttnghia-vaino/gomsu

## Overview

##### Project type and purpose
- The file tree and minimal README indicate “GomSu” is an ASP.NET Core MVC web application—likely an e-commerce site for pottery/ceramics (“SanPham”, “DonHang”, “GioHang” models).
- It follows the typical MVC pattern with Controllers, Models, Views, data access via Entity Framework Core (GomsuContext), and an email service.

##### File structure
- Top-level:
- GomSu/Controllers — MVC controllers (Account, Home, SanPham)
- GomSu/Models — EF Core entities + DbContext + other domain models (Order, Product, Cart, Voucher, EmailSettings)
- GomSu/Services — application services (EmailService)
- GomSu/ViewModels — DTOs for forms (Register, Login, ForgotPassword)
- GomSu/Views — Razor views and partials for each controller + shared layout
- wwwroot — static assets (css, js, images, libs)
- appsettings.json & appsettings.Development.json — configuration (database connection, SMTP)
- Program.cs & launchSettings.json — ASP.NET Core startup and environment config

##### README for additional insights
- README contains only project title. No explicit architecture notes, so we infer from structure and naming.

##### Elements
- Clear labels: “Browser,” “ASP.NET Core MVC App,” “SQL Database,” “SMTP Server”
- Browser → Controller (HTTP requests)
- Controller → DbContext → Database (data flow)
- Controller/Service → SMTP (email sending)
- Another for server-side code (Controllers, Services, Models)
- Another for external systems (Database, SMTP)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Browser["Browser\n(User Interface)"]:::ui
        RazorViews["Razor Views"]:::ui
        StaticAssets["Static Assets\n(CSS/JS/Images/Libs)"]:::ui
    end

    %% Application Layer
    subgraph "Application Layer" 
        direction TB
        Controllers["Controllers"]:::server
        Services["EmailService"]:::server
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DbContext["GomsuContext\n(EF Core DbContext)"]:::server
        Entities["Domain Entities"]:::server
    end

    %% External Systems
    SQLDB["SQL Database"]:::database
    SMTP["SMTP Server"]:::external

    %% Connections
    Browser -->|"HTTP GET/POST"| Controllers
    Controllers -->|"Render Views"| RazorViews
    Controllers -->|"Serve Static"| StaticAssets
    Controllers -->|"Use DbContext"| DbContext
    Controllers -->|"Call Service"| Services
    DbContext -->|"CRUD via EF Core"| SQLDB
    Services -->|"Send Email"| SMTP

    %% Click Events
    click RazorViews "https://github.com/ttnghia-vaino/gomsu/tree/master/GomSu/Views"
    click StaticAssets "https://github.com/ttnghia-vaino/gomsu/tree/master/GomSu/wwwroot"
    click Controllers "https://github.com/ttnghia-vaino/gomsu/blob/master/GomSu/Controllers/AccountController.cs"
    click Services "https://github.com/ttnghia-vaino/gomsu/blob/master/GomSu/Services/EmailService.cs"
    click DbContext "https://github.com/ttnghia-vaino/gomsu/blob/master/GomSu/Models/GomsuContext.cs"
    click SQLDB "https://github.com/ttnghia-vaino/gomsu/blob/master/GomSu/appsettings.json"
    click SMTP "https://github.com/ttnghia-vaino/gomsu/blob/master/GomSu/Models/EmailSettings.cs"

    %% Styles
    classDef ui fill:#E8F4FC,stroke:#333,stroke-width:1px
    classDef server fill:#F0F0F0,stroke:#333,stroke-width:1px
    classDef database fill:#FFF0D4,stroke:#333,stroke-width:1px
    classDef external fill:#FFE0E0,stroke:#333,stroke-width:1px
```
