# tadlhvuong/caterin architecture

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

- Interactive diagram: https://gitdiagram.com/tadlhvuong/caterin
- Repository: https://github.com/tadlhvuong/caterin

## Overview

The tree indicates an ASP.NET Core commerce and CMS application with customer and admin surfaces, identity, catalog, orders, inventory, and real-time chat. The clearest sampled workflow is account authentication: the website account controller delegates to the authentication service, which validates and manages users and tokens. Product management and chat are separate major capabilities. Source excerpts are limited, so edges are included only where the excerpts or SOURCE INDEX show a relationship; other subsystems are represented without guessed wiring.

Main entry points: [`Shared/Services/Authentication/AuthService.cs`](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Authentication/AuthService.cs) (Authentication), [`Shared/Services/Product/ProductService.cs`](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Product/ProductService.cs) (Product catalog), [`Website/Controllers/AccountController.cs`](https://github.com/tadlhvuong/caterin/blob/main/Website/Controllers/AccountController.cs) (Customer pages), [`Shared/Data/Context/AppDbContext.cs`](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Context/AppDbContext.cs) (Application database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_customer["Customer pages"]
  node_admin["Admin portal"]
end

subgraph group_identity["Identity and security"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_user["User accounts<br/>[AppUser.cs]"]
  node_refresh["Refresh tokens<br/>[RefreshToken.cs]"]
  node_permission["Permissions<br/>[Permission.cs]"]
  node_validation["User validation"]
end

subgraph group_commerce["Commerce operations"]
  node_product["Product catalog<br/>[ProductService.cs]"]
  node_productentity["Product records<br/>[Product.cs]"]
  node_orders["Order management<br/>[OrderService.cs]"]
  node_inventory["Inventory<br/>[CustomerService.cs]"]
end

subgraph group_chat["Customer chat"]
  node_chatapi["Chat endpoints<br/>[ChatController.cs]"]
  node_chatservices["Chat services"]
  node_realtime["Chat realtime"]
end

subgraph group_platform["Shared platform"]
  node_database[("Application database<br/>[AppDbContext.cs]")]
  node_common["Common helpers<br/>[CommonHelper.cs]"]
end

node_actor(("Site visitor"))

node_actor -->|"uses account pages"| node_customer
node_customer -->|"delegates authentication"| node_auth
node_auth -->|"finds users"| node_user
node_auth -->|"validates login"| node_validation
node_auth -->|"rotates sessions"| node_refresh
node_auth -->|"uses database"| node_database
node_product -->|"uses database"| node_database
node_product -->|"manages products"| node_productentity
node_chatapi -->|"uses chat contracts"| node_chatservices
node_admin -.-> node_auth

click node_customer "https://github.com/tadlhvuong/caterin/blob/main/Website/Controllers/AccountController.cs"
click node_admin "https://github.com/tadlhvuong/caterin/tree/main/Website/Areas/Admin/Controllers"
click node_auth "https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Authentication/AuthService.cs"
click node_user "https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/AppUser.cs"
click node_refresh "https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/RefreshToken.cs"
click node_permission "https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/Core/Permission.cs"
click node_validation "https://github.com/tadlhvuong/caterin/blob/main/Shared/UserValidation/DTOs/UserValidationContext.cs"
click node_product "https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Product/ProductService.cs"
click node_productentity "https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Product/Product.cs"
click node_orders "https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Order/OrderService.cs"
click node_inventory "https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Customer/CustomerService.cs"
click node_chatapi "https://github.com/tadlhvuong/caterin/blob/main/Website/Controllers/ChatController.cs"
click node_chatservices "https://github.com/tadlhvuong/caterin/tree/main/Shared/Services/Chat"
click node_realtime "https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Notification/ChatRealtimeNotifier.cs"
click node_database "https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Context/AppDbContext.cs"
click node_common "https://github.com/tadlhvuong/caterin/blob/main/Shared/Common/CommonHelper.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customer,node_admin toneBlue
class node_auth,node_user,node_refresh,node_permission,node_validation toneAmber
class node_product,node_productentity,node_orders,node_inventory toneMint
class node_chatapi,node_chatservices,node_realtime toneRose
class node_database,node_common,node_actor toneIndigo
```

## Components

### Web experience

- [Customer pages](https://github.com/tadlhvuong/caterin/blob/main/Website/Controllers/AccountController.cs): `Website/Controllers/AccountController.cs`
- [Admin portal](https://github.com/tadlhvuong/caterin/tree/main/Website/Areas/Admin/Controllers): `Website/Areas/Admin/Controllers`

### Identity and security

- [Authentication](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Authentication/AuthService.cs): `Shared/Services/Authentication/AuthService.cs`
- [User accounts](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/AppUser.cs): `Shared/Data/Entities/Identity/AppUser.cs`
- [Refresh tokens](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/RefreshToken.cs): `Shared/Data/Entities/Identity/RefreshToken.cs`
- [Permissions](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Identity/Core/Permission.cs): `Shared/Data/Entities/Identity/Core/Permission.cs`
- [User validation](https://github.com/tadlhvuong/caterin/blob/main/Shared/UserValidation/DTOs/UserValidationContext.cs): `Shared/UserValidation/DTOs/UserValidationContext.cs`

### Commerce operations

- [Product catalog](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Product/ProductService.cs): `Shared/Services/Product/ProductService.cs`
- [Product records](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Entities/Product/Product.cs): `Shared/Data/Entities/Product/Product.cs`
- [Order management](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Order/OrderService.cs): `Shared/Services/Order/OrderService.cs`
- [Inventory](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Customer/CustomerService.cs): `Shared/Services/Customer/CustomerService.cs`

### Customer chat

- [Chat endpoints](https://github.com/tadlhvuong/caterin/blob/main/Website/Controllers/ChatController.cs): `Website/Controllers/ChatController.cs`
- [Chat services](https://github.com/tadlhvuong/caterin/tree/main/Shared/Services/Chat): `Shared/Services/Chat`
- [Chat realtime](https://github.com/tadlhvuong/caterin/blob/main/Shared/Services/Notification/ChatRealtimeNotifier.cs): `Shared/Services/Notification/ChatRealtimeNotifier.cs`

### Shared platform

- [Application database](https://github.com/tadlhvuong/caterin/blob/main/Shared/Data/Context/AppDbContext.cs): `Shared/Data/Context/AppDbContext.cs`
- [Common helpers](https://github.com/tadlhvuong/caterin/blob/main/Shared/Common/CommonHelper.cs): `Shared/Common/CommonHelper.cs`

### Other components

- **Site visitor**

## Connections

- Site visitor → Customer pages: uses account pages (evidence: `Website/Controllers/AccountController.cs`)
- Customer pages → Authentication: delegates authentication (evidence: `Website/Controllers/AccountController.cs`)
- Authentication → User accounts: finds users (evidence: `Shared/Services/Authentication/AuthService.cs`)
- Authentication → User validation: validates login (evidence: `Shared/Services/Authentication/AuthService.cs`)
- Authentication → Refresh tokens: rotates sessions (evidence: `Shared/Services/Authentication/AuthService.cs`)
- Authentication → Application database: uses database (evidence: `Shared/Services/Authentication/AuthService.cs`)
- Product catalog → Application database: uses database (evidence: `Shared/Services/Product/ProductService.cs`)
- Product catalog → Product records: manages products (evidence: `Shared/Services/Product/ProductService.cs`)
- Chat endpoints → Chat services: uses chat contracts (evidence: `Website/Controllers/ChatController.cs`)
- Admin portal → Authentication
