# aminbagherinezhad/clean-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/aminbagherinezhad/clean-architecture
- Repository: https://github.com/aminbagherinezhad/clean-architecture

## Overview

This is a notification API with endpoints to set the default channel, send notifications, and retrieve history. Requests enter through the controller; the application service selects a sender, persists notification state, and returns DTOs. The graph also shows configuration and history operations, plus the repository/database and channel-sender layers. Relationships are based on the controller, service, repository, context, and dependency-registration excerpts or SOURCE INDEX references; unsampled startup wiring and sender internals are not inferred.

Main entry points: [`Notification.Application/Services/NotificationService.cs`](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Services/NotificationService.cs) (Notification service), [`Notification.Infrastructure/Extensions/DependencyInjection.cs`](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Extensions/DependencyInjection.cs) (Infrastructure registration), [`Notification.Api/Controllers/NotificationController.cs`](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Api/Controllers/NotificationController.cs) (Notification endpoints), [`Notification.Infrastructure/Repositories/NotificationRepository.cs`](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Repositories/NotificationRepository.cs) (Notification repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_controller["Notification endpoints"]
end

subgraph group_application["Application"]
  node_service["Notification service"]
  node_request["Send request"]
  node_response["Notification DTO<br/>[NotificationDto.cs]"]
  node_service_contract["Service contract"]
  node_repo_contract["Repository contract"]
  node_sender_contract["Sender contract"]
end

subgraph group_domain["Domain"]
  node_notification["Notification record<br/>[Notification.cs]"]
  node_config["Channel configuration"]
end

subgraph group_infrastructure["Infrastructure"]
  node_repository["Notification repository"]
  node_context["Database context<br/>[AppDbContext.cs]"]
  node_database[("PostgreSQL database")]
  node_email["Email sender"]
  node_sms["SMS sender"]
  node_registration["Infrastructure registration"]
end

node_client(("API client"))

node_client -->|"calls endpoints"| node_controller
node_controller -->|"delegates requests"| node_service
node_controller -->|"accepts"| node_request
node_service -->|"reads"| node_request
node_service -->|"creates"| node_response
node_service -->|"creates and updates"| node_notification
node_service -->|"reads and sets"| node_config
node_service -->|"loads and saves"| node_repository
node_service -->|"dispatches by type"| node_email
node_service -->|"dispatches by type"| node_sms
node_repository -->|"queries and updates"| node_context
node_context -.->|"persists entities"| node_database
node_registration -->|"registers implementation"| node_repository
node_registration -->|"registers sender"| node_email
node_registration -->|"registers sender"| node_sms

click node_controller "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Api/Controllers/NotificationController.cs"
click node_service "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Services/NotificationService.cs"
click node_request "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/DTOs/SendNotificationRequest.cs"
click node_response "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/DTOs/NotificationDto.cs"
click node_service_contract "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationService.cs"
click node_repo_contract "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationRepository.cs"
click node_sender_contract "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationSender.cs"
click node_notification "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Domain/Entities/Notification.cs"
click node_config "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Domain/Entities/NotificationConfig.cs"
click node_repository "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Repositories/NotificationRepository.cs"
click node_context "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Data/AppDbContext.cs"
click node_email "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/NotificationSenders/EmailNotificationSender.cs"
click node_sms "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/NotificationSenders/SmsNotificationSender.cs"
click node_registration "https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Extensions/DependencyInjection.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_controller,node_client toneBlue
class node_service,node_request,node_response,node_service_contract,node_repo_contract,node_sender_contract toneAmber
class node_notification,node_config toneMint
class node_repository,node_context,node_database,node_email,node_sms,node_registration toneRose
```

## Components

### API

- [Notification endpoints](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Api/Controllers/NotificationController.cs): `Notification.Api/Controllers/NotificationController.cs`

### Application

- [Notification service](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Services/NotificationService.cs): `Notification.Application/Services/NotificationService.cs`
- [Send request](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/DTOs/SendNotificationRequest.cs): `Notification.Application/DTOs/SendNotificationRequest.cs`
- [Notification DTO](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/DTOs/NotificationDto.cs): `Notification.Application/DTOs/NotificationDto.cs`
- [Service contract](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationService.cs): `Notification.Application/Interfaces/INotificationService.cs`
- [Repository contract](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationRepository.cs): `Notification.Application/Interfaces/INotificationRepository.cs`
- [Sender contract](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Application/Interfaces/INotificationSender.cs): `Notification.Application/Interfaces/INotificationSender.cs`

### Domain

- [Notification record](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Domain/Entities/Notification.cs): `Notification.Domain/Entities/Notification.cs`
- [Channel configuration](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Domain/Entities/NotificationConfig.cs): `Notification.Domain/Entities/NotificationConfig.cs`

### Infrastructure

- [Notification repository](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Repositories/NotificationRepository.cs): `Notification.Infrastructure/Repositories/NotificationRepository.cs`
- [Database context](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Data/AppDbContext.cs): `Notification.Infrastructure/Data/AppDbContext.cs`
- **PostgreSQL database**
- [Email sender](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/NotificationSenders/EmailNotificationSender.cs): `Notification.Infrastructure/NotificationSenders/EmailNotificationSender.cs`
- [SMS sender](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/NotificationSenders/SmsNotificationSender.cs): `Notification.Infrastructure/NotificationSenders/SmsNotificationSender.cs`
- [Infrastructure registration](https://github.com/aminbagherinezhad/clean-architecture/blob/main/Notification.Infrastructure/Extensions/DependencyInjection.cs): `Notification.Infrastructure/Extensions/DependencyInjection.cs`

### Other components

- **API client**

## Connections

- API client → Notification endpoints: calls endpoints (evidence: `Notification.Api/Controllers/NotificationController.cs`)
- Notification endpoints → Notification service: delegates requests (evidence: `Notification.Api/Controllers/NotificationController.cs`)
- Notification endpoints → Send request: accepts (evidence: `Notification.Api/Controllers/NotificationController.cs`)
- Notification service → Send request: reads (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → Notification DTO: creates (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → Notification record: creates and updates (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → Channel configuration: reads and sets (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → Notification repository: loads and saves (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → Email sender: dispatches by type (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification service → SMS sender: dispatches by type (evidence: `Notification.Application/Services/NotificationService.cs`)
- Notification repository → Database context: queries and updates (evidence: `Notification.Infrastructure/Repositories/NotificationRepository.cs`)
- Database context → PostgreSQL database: persists entities
- Infrastructure registration → Notification repository: registers implementation (evidence: `Notification.Infrastructure/Extensions/DependencyInjection.cs`)
- Infrastructure registration → Email sender: registers sender (evidence: `Notification.Infrastructure/Extensions/DependencyInjection.cs`)
- Infrastructure registration → SMS sender: registers sender (evidence: `Notification.Infrastructure/Extensions/DependencyInjection.cs`)
