# phantri1912/donation architecture

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

- Interactive diagram: https://gitdiagram.com/phantri1912/donation
- Repository: https://github.com/phantri1912/donation

## Overview

This is an ASP.NET Core charity-fundraising application. A visitor browses eligible projects, views details, and starts a donation; the payment controller creates and confirms PayPal orders while recording payment state. Registered users can manage projects, give feedback, use accounts and wallets, and communicate through chat. Admins manage projects and organizations and view statistics. The graph reflects sampled controller/service calls and the documented app setup; several listed controllers and services were not sampled, so their internal wiring is left out.

Main entry points: [`Data/GrabTuThienContext.cs`](https://github.com/phantri1912/donation/blob/master/Data/GrabTuThienContext.cs) (Application database), [`Areas/Project/Controllers/ProjectController.cs`](https://github.com/phantri1912/donation/blob/master/Areas/Project/Controllers/ProjectController.cs) (Project browsing), [`Program.cs`](https://github.com/phantri1912/donation/blob/master/Program.cs) (ASP.NET app host), [`Areas/User/Controllers/PaymentController.cs`](https://github.com/phantri1912/donation/blob/master/Areas/User/Controllers/PaymentController.cs) (Payments and deposits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fundraising["Fundraising"]
  node_project_web["Project browsing"]
  node_payment_web["Payments and deposits"]
  node_donation_history["Donation history"]
  node_project_services["Project services<br/>[ProjectBLL.cs]"]
end

subgraph group_accounts["Accounts and chat"]
  node_user_account["User accounts"]
  node_chat_api["Chat history API<br/>[ChatController.cs]"]
end

subgraph group_administration["Administration"]
  node_project_admin["Project administration"]
  node_project_builder["Project list builder<br/>[BuildProjectBLL.cs]"]
  node_org_admin["Organization administration<br/>[OrgController.cs]"]
  node_org_builder["Organization list builder"]
  node_admin_stats["Admin statistics"]
  node_organization_services["Organization services<br/>[OrganizationBLL.cs]"]
end

subgraph group_platform["Application services"]
  node_websocket["WebSocket middleware"]
  node_socket_manager["Socket connection manager"]
  node_expiry["Project expiry worker"]
  node_database[("Application database")]
  node_domain_models["Donation and project records<br/>[Project.cs]"]
  node_app_host["ASP.NET app host<br/>[Program.cs]"]
end

node_visitor(("Visitor"))
node_user(("Registered user"))
node_admin(("Administrator"))
node_paypal{{"PayPal"}}
node_email{{"Email delivery"}}

node_visitor -->|"browses projects"| node_project_web
node_user -->|"manages and comments"| node_project_web
node_project_web -->|"checks projects"| node_project_services
node_project_web -->|"queries and saves"| node_database
node_user -->|"starts payment"| node_payment_web
node_payment_web -->|"reads and records orders"| node_database
node_payment_web -.->|"creates and captures orders"| node_paypal
node_admin -->|"manages projects"| node_project_admin
node_project_admin -->|"builds project lists"| node_project_builder
node_project_admin -->|"manages projects"| node_project_services
node_admin -->|"manages organizations"| node_org_admin
node_org_admin -->|"builds organization lists"| node_org_builder
node_org_admin -->|"manages organizations"| node_organization_services
node_admin -->|"views statistics"| node_admin_stats
node_user -->|"registers and signs in"| node_user_account
node_user_account -->|"reads and saves accounts"| node_database
node_user_account -.->|"sends verification email"| node_email
node_user -->|"requests chat history"| node_chat_api
node_chat_api -->|"reads conversations and messages"| node_database
node_app_host -->|"registers middleware"| node_websocket
node_app_host -->|"registers manager"| node_socket_manager
node_app_host -->|"starts worker"| node_expiry
node_expiry -->|"marks expired projects"| node_database
node_donation_history -->|"accesses donation data"| node_database
node_database -->|"stores"| node_domain_models

click node_project_web "https://github.com/phantri1912/donation/blob/master/Areas/Project/Controllers/ProjectController.cs"
click node_payment_web "https://github.com/phantri1912/donation/blob/master/Areas/User/Controllers/PaymentController.cs"
click node_donation_history "https://github.com/phantri1912/donation/blob/master/Services/DonateHistoryBLL.cs"
click node_project_admin "https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/ProjectController.cs"
click node_project_builder "https://github.com/phantri1912/donation/blob/master/Services/BuildProjectBLL.cs"
click node_org_admin "https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/OrgController.cs"
click node_org_builder "https://github.com/phantri1912/donation/blob/master/Services/BuildOrganizationBLL.cs"
click node_admin_stats "https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/StatisticController.cs"
click node_user_account "https://github.com/phantri1912/donation/blob/master/Areas/User/Controllers/AccountController.cs"
click node_chat_api "https://github.com/phantri1912/donation/blob/master/Controllers/ChatController.cs"
click node_websocket "https://github.com/phantri1912/donation/blob/master/Services/WebSockets/WebSocketMiddleware.cs"
click node_socket_manager "https://github.com/phantri1912/donation/blob/master/Services/WebSockets/WebSocketConnectionManager.cs"
click node_expiry "https://github.com/phantri1912/donation/blob/master/Services/ProjectExpiryService.cs"
click node_project_services "https://github.com/phantri1912/donation/blob/master/Services/ProjectBLL.cs"
click node_organization_services "https://github.com/phantri1912/donation/blob/master/Services/OrganizationBLL.cs"
click node_database "https://github.com/phantri1912/donation/blob/master/Data/GrabTuThienContext.cs"
click node_domain_models "https://github.com/phantri1912/donation/blob/master/Data/Models/Project.cs"
click node_app_host "https://github.com/phantri1912/donation/blob/master/Program.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_project_web,node_payment_web,node_donation_history,node_project_services,node_user toneBlue
class node_user_account,node_chat_api toneAmber
class node_project_admin,node_project_builder,node_org_admin,node_org_builder,node_admin_stats,node_organization_services toneMint
class node_websocket,node_socket_manager,node_expiry,node_database,node_domain_models,node_app_host toneRose
class node_visitor,node_admin,node_paypal,node_email toneIndigo
```

## Components

### Fundraising

- [Project browsing](https://github.com/phantri1912/donation/blob/master/Areas/Project/Controllers/ProjectController.cs): `Areas/Project/Controllers/ProjectController.cs`
- [Payments and deposits](https://github.com/phantri1912/donation/blob/master/Areas/User/Controllers/PaymentController.cs): `Areas/User/Controllers/PaymentController.cs`
- [Donation history](https://github.com/phantri1912/donation/blob/master/Services/DonateHistoryBLL.cs): `Services/DonateHistoryBLL.cs`
- [Project services](https://github.com/phantri1912/donation/blob/master/Services/ProjectBLL.cs): `Services/ProjectBLL.cs`

### Accounts and chat

- [User accounts](https://github.com/phantri1912/donation/blob/master/Areas/User/Controllers/AccountController.cs): `Areas/User/Controllers/AccountController.cs`
- [Chat history API](https://github.com/phantri1912/donation/blob/master/Controllers/ChatController.cs): `Controllers/ChatController.cs`

### Administration

- [Project administration](https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/ProjectController.cs): `Areas/Admin/Controllers/ProjectController.cs`
- [Project list builder](https://github.com/phantri1912/donation/blob/master/Services/BuildProjectBLL.cs): `Services/BuildProjectBLL.cs`
- [Organization administration](https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/OrgController.cs): `Areas/Admin/Controllers/OrgController.cs`
- [Organization list builder](https://github.com/phantri1912/donation/blob/master/Services/BuildOrganizationBLL.cs): `Services/BuildOrganizationBLL.cs`
- [Admin statistics](https://github.com/phantri1912/donation/blob/master/Areas/Admin/Controllers/StatisticController.cs): `Areas/Admin/Controllers/StatisticController.cs`
- [Organization services](https://github.com/phantri1912/donation/blob/master/Services/OrganizationBLL.cs): `Services/OrganizationBLL.cs`

### Application services

- [WebSocket middleware](https://github.com/phantri1912/donation/blob/master/Services/WebSockets/WebSocketMiddleware.cs): `Services/WebSockets/WebSocketMiddleware.cs`
- [Socket connection manager](https://github.com/phantri1912/donation/blob/master/Services/WebSockets/WebSocketConnectionManager.cs): `Services/WebSockets/WebSocketConnectionManager.cs`
- [Project expiry worker](https://github.com/phantri1912/donation/blob/master/Services/ProjectExpiryService.cs): `Services/ProjectExpiryService.cs`
- [Application database](https://github.com/phantri1912/donation/blob/master/Data/GrabTuThienContext.cs): `Data/GrabTuThienContext.cs`
- [Donation and project records](https://github.com/phantri1912/donation/blob/master/Data/Models/Project.cs): `Data/Models/Project.cs`
- [ASP.NET app host](https://github.com/phantri1912/donation/blob/master/Program.cs): `Program.cs`

### Other components

- **Visitor**
- **Registered user**
- **Administrator**
- **PayPal**
- **Email delivery**

## Connections

- Visitor → Project browsing: browses projects
- Registered user → Project browsing: manages and comments
- Project browsing → Project services: checks projects
- Project browsing → Application database: queries and saves
- Registered user → Payments and deposits: starts payment
- Payments and deposits → Application database: reads and records orders
- Payments and deposits → PayPal: creates and captures orders
- Administrator → Project administration: manages projects
- Project administration → Project list builder: builds project lists
- Project administration → Project services: manages projects
- Administrator → Organization administration: manages organizations
- Organization administration → Organization list builder: builds organization lists
- Organization administration → Organization services: manages organizations
- Administrator → Admin statistics: views statistics
- Registered user → User accounts: registers and signs in
- User accounts → Application database: reads and saves accounts
- User accounts → Email delivery: sends verification email
- Registered user → Chat history API: requests chat history
- Chat history API → Application database: reads conversations and messages
- ASP.NET app host → WebSocket middleware: registers middleware
- ASP.NET app host → Socket connection manager: registers manager
- ASP.NET app host → Project expiry worker: starts worker
- Project expiry worker → Application database: marks expired projects
- Donation history → Application database: accesses donation data
- Application database → Donation and project records: stores
