# 3bd-allah/donation-hub architecture

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

- Interactive diagram: https://gitdiagram.com/3bd-allah/donation-hub
- Repository: https://github.com/3bd-allah/donation-hub

## Overview

DonationHub is an ASP.NET Core donation and crowdfunding API. Users register or sign in, then use JWT-protected endpoints; category reads are public, while category changes require an admin. The application also models campaigns and donations, but the supplied tree and excerpts do not show campaign or donation request workflows, so those are represented as domain and persistence capabilities rather than an invented pipeline. The graph focuses on demonstrated controller dispatch, selected use-case dependencies, and startup seeding; unsampled feature implementations are not assumed.

Main entry points: [`DonationHub.Infrastructure/Persistence/AppDbContext.cs`](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/AppDbContext.cs) (EF Core Context), [`DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs) (Database Seeder), [`DonationHub.Domain/Entities/Category.cs`](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Category.cs) (Category Model), [`DonationHub.Infrastructure/Identity/ApplicationUser.cs`](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Identity/ApplicationUser.cs) (Identity User)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_auth_api["Authentication Endpoints<br/>[AuthController.cs]"]
  node_category_api["Category Endpoints"]
  node_startup["API Startup<br/>[Program.cs]"]
end

subgraph group_application["Application Use Cases"]
  node_auth_cases["Authentication Use Cases<br/>[Authentication]"]
  node_login_handler["Login Handler"]
  node_refresh_handler["Refresh Handler"]
  node_category_cases["Category Use Cases<br/>[Categories]"]
  node_category_query["Category Detail Query"]
  node_app_contracts["Application Contracts<br/>[RequestResponse.cs]"]
end

subgraph group_domain["Domain Model"]
  node_category_model["Category Model<br/>[Category.cs]"]
  node_campaign_model["Campaign Model<br/>[Campaign.cs]"]
  node_donation_model["Donation Model<br/>[Donation.cs]"]
  node_refresh_model["Refresh Token Model<br/>[RefreshToken.cs]"]
end

subgraph group_infrastructure["Identity and Persistence"]
  node_user_model["Identity User<br/>[ApplicationUser.cs]"]
  node_login_service["Login Service<br/>[LoginService.cs]"]
  node_token_service["Token Service<br/>[TokenService.cs]"]
  node_db_context["EF Core Context<br/>[AppDbContext.cs]"]
  node_repository["Generic Repository<br/>[BaseRepository.cs]"]
  node_seeder["Database Seeder<br/>[DatabaseSeeder.cs]"]
end

node_client(("API Client"))
node_database[("SQL Server Database")]

node_client -->|"sends requests"| node_auth_api
node_client -->|"sends requests"| node_category_api
node_auth_api -->|"dispatches requests"| node_auth_cases
node_category_api -->|"dispatches requests"| node_category_cases
node_login_handler -->|"calls"| node_login_service
node_login_handler -->|"calls"| node_token_service
node_refresh_handler -->|"calls"| node_token_service
node_login_service -->|"uses identity"| node_user_model
node_category_query -->|"queries"| node_repository
node_category_query -->|"reads"| node_category_model
node_repository -->|"uses"| node_db_context
node_db_context -.->|"persists entities"| node_database
node_db_context -->|"maps"| node_user_model
node_db_context -->|"maps"| node_category_model
node_db_context -->|"maps"| node_campaign_model
node_db_context -->|"maps"| node_donation_model
node_db_context -->|"maps"| node_refresh_model
node_seeder -->|"seeds data"| node_db_context
node_seeder -->|"creates admin"| node_user_model
node_seeder -->|"creates categories"| node_category_model
node_seeder -->|"creates campaign"| node_campaign_model
node_startup -->|"runs seeding"| node_seeder
node_startup -->|"configures startup"| node_db_context

click node_auth_api "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/Controllers/AuthController.cs"
click node_category_api "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/Controllers/CategoryController.cs"
click node_auth_cases "https://github.com/3bd-allah/donation-hub/tree/main/DontationHub.Application/Features/Authentication"
click node_login_handler "https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Authentication/Login/LoginCommandHandler.cs"
click node_refresh_handler "https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Authentication/Refresh/RotateRefreshTokenHandler.cs"
click node_category_cases "https://github.com/3bd-allah/donation-hub/tree/main/DontationHub.Application/Features/Categories"
click node_category_query "https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Categories/GetById/GetCategoryByIdQuery.cs"
click node_app_contracts "https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Shared/RequestResponse.cs"
click node_user_model "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Identity/ApplicationUser.cs"
click node_login_service "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Authentication/LoginService.cs"
click node_token_service "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Services/TokenService.cs"
click node_db_context "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/AppDbContext.cs"
click node_repository "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Repositories/BaseRepository.cs"
click node_category_model "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Category.cs"
click node_campaign_model "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Campaign.cs"
click node_donation_model "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Donation.cs"
click node_refresh_model "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/RefreshToken.cs"
click node_seeder "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs"
click node_startup "https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/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_auth_api,node_category_api,node_startup,node_client toneBlue
class node_auth_cases,node_login_handler,node_refresh_handler,node_category_cases,node_category_query,node_app_contracts,node_database toneAmber
class node_category_model,node_campaign_model,node_donation_model,node_refresh_model toneMint
class node_user_model,node_login_service,node_token_service,node_db_context,node_repository,node_seeder toneRose
```

## Components

### HTTP API

- [Authentication Endpoints](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/Controllers/AuthController.cs): `DonationHub.Api/Controllers/AuthController.cs`
- [Category Endpoints](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/Controllers/CategoryController.cs): `DonationHub.Api/Controllers/CategoryController.cs`
- [API Startup](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Api/Program.cs): `DonationHub.Api/Program.cs`

### Application Use Cases

- [Authentication Use Cases](https://github.com/3bd-allah/donation-hub/tree/main/DontationHub.Application/Features/Authentication): `DontationHub.Application/Features/Authentication`
- [Login Handler](https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Authentication/Login/LoginCommandHandler.cs): `DontationHub.Application/Features/Authentication/Login/LoginCommandHandler.cs`
- [Refresh Handler](https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Authentication/Refresh/RotateRefreshTokenHandler.cs): `DontationHub.Application/Features/Authentication/Refresh/RotateRefreshTokenHandler.cs`
- [Category Use Cases](https://github.com/3bd-allah/donation-hub/tree/main/DontationHub.Application/Features/Categories): `DontationHub.Application/Features/Categories`
- [Category Detail Query](https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Features/Categories/GetById/GetCategoryByIdQuery.cs): `DontationHub.Application/Features/Categories/GetById/GetCategoryByIdQuery.cs`
- [Application Contracts](https://github.com/3bd-allah/donation-hub/blob/main/DontationHub.Application/Shared/RequestResponse.cs): `DontationHub.Application/Shared/RequestResponse.cs`

### Domain Model

- [Category Model](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Category.cs): `DonationHub.Domain/Entities/Category.cs`
- [Campaign Model](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Campaign.cs): `DonationHub.Domain/Entities/Campaign.cs`
- [Donation Model](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/Donation.cs): `DonationHub.Domain/Entities/Donation.cs`
- [Refresh Token Model](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Domain/Entities/RefreshToken.cs): `DonationHub.Domain/Entities/RefreshToken.cs`

### Identity and Persistence

- [Identity User](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Identity/ApplicationUser.cs): `DonationHub.Infrastructure/Identity/ApplicationUser.cs`
- [Login Service](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Authentication/LoginService.cs): `DonationHub.Infrastructure/Authentication/LoginService.cs`
- [Token Service](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Services/TokenService.cs): `DonationHub.Infrastructure/Services/TokenService.cs`
- [EF Core Context](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/AppDbContext.cs): `DonationHub.Infrastructure/Persistence/AppDbContext.cs`
- [Generic Repository](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Repositories/BaseRepository.cs): `DonationHub.Infrastructure/Repositories/BaseRepository.cs`
- [Database Seeder](https://github.com/3bd-allah/donation-hub/blob/main/DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs): `DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`

### Other components

- **API Client**
- **SQL Server Database**

## Connections

- API Client → Authentication Endpoints: sends requests (evidence: `DonationHub.Api/Controllers/AuthController.cs`)
- API Client → Category Endpoints: sends requests (evidence: `DonationHub.Api/Controllers/CategoryController.cs`)
- Authentication Endpoints → Authentication Use Cases: dispatches requests (evidence: `DonationHub.Api/Controllers/AuthController.cs`)
- Category Endpoints → Category Use Cases: dispatches requests (evidence: `DonationHub.Api/Controllers/CategoryController.cs`)
- Login Handler → Login Service: calls (evidence: `DontationHub.Application/Features/Authentication/Login/LoginCommandHandler.cs`)
- Login Handler → Token Service: calls (evidence: `DontationHub.Application/Features/Authentication/Login/LoginCommandHandler.cs`)
- Refresh Handler → Token Service: calls (evidence: `DontationHub.Application/Features/Authentication/Refresh/RotateRefreshTokenHandler.cs`)
- Login Service → Identity User: uses identity (evidence: `DonationHub.Infrastructure/Authentication/LoginService.cs`)
- Category Detail Query → Generic Repository: queries (evidence: `DontationHub.Application/Features/Categories/GetById/GetCategoryByIdQuery.cs`)
- Category Detail Query → Category Model: reads (evidence: `DontationHub.Application/Features/Categories/GetById/GetCategoryByIdQuery.cs`)
- Generic Repository → EF Core Context: uses (evidence: `DonationHub.Infrastructure/Repositories/BaseRepository.cs`)
- EF Core Context → SQL Server Database: persists entities (evidence: `README.md`)
- EF Core Context → Identity User: maps (evidence: `DonationHub.Infrastructure/Persistence/AppDbContext.cs`)
- EF Core Context → Category Model: maps (evidence: `DonationHub.Infrastructure/Persistence/AppDbContext.cs`)
- EF Core Context → Campaign Model: maps (evidence: `DonationHub.Infrastructure/Persistence/AppDbContext.cs`)
- EF Core Context → Donation Model: maps (evidence: `DonationHub.Infrastructure/Persistence/AppDbContext.cs`)
- EF Core Context → Refresh Token Model: maps (evidence: `DonationHub.Infrastructure/Persistence/AppDbContext.cs`)
- Database Seeder → EF Core Context: seeds data (evidence: `DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`)
- Database Seeder → Identity User: creates admin (evidence: `DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`)
- Database Seeder → Category Model: creates categories (evidence: `DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`)
- Database Seeder → Campaign Model: creates campaign (evidence: `DonationHub.Infrastructure/Persistence/Seed/DatabaseSeeder.cs`)
- API Startup → Database Seeder: runs seeding (evidence: `DonationHub.Api/Program.cs`)
- API Startup → EF Core Context: configures startup (evidence: `DonationHub.Api/Program.cs`)
