# ahmadabdelbary2001/hr.leavemanagement.clean architecture

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

- Interactive diagram: https://gitdiagram.com/ahmadabdelbary2001/hr.leavemanagement.clean
- Repository: https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean

## Overview

This is a Clean Architecture HR leave-management application with a Blazor client and .NET API. The principal workflow is an employee or administrator using the client to authenticate and manage leave types, submit or review leave requests, and manage allocations; application handlers apply CRUD/query behavior through persistence contracts, with identity details available for request views. The graph preserves those domain stages and the identity, persistence, and infrastructure layers. Some handlers and UI pages were not sampled, so those links rely only on documented capabilities or are omitted; unsampled internals are not asserted.

Main entry points: [`HR.LeaveManagement.Api/Program.cs`](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Program.cs) (API host), [`HR.LeaveManagement.Persistence/Repositories`](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Persistence/Repositories) (Leave repositories), [`HR.LeaveManagement.Application/Features/LeaveRequest`](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveRequest) (Request workflow), [`HR.LeaveManagement.Api/Controllers/AuthController.cs`](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/AuthController.cs) (Authentication endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Blazor client"]
  node_blazor["Blazor UI"]
  node_ui_auth["Client authentication"]
end

subgraph group_api["API boundary"]
  node_api_host["API host<br/>[Program.cs]"]
  node_auth_api["Authentication endpoints<br/>[AuthController.cs]"]
  node_leave_api["Leave endpoints"]
  node_alloc_api["Allocation endpoints"]
  node_type_api["Leave type endpoints"]
end

subgraph group_application["Application features"]
  node_request_features["Request workflow<br/>[LeaveRequest]"]
  node_allocation_features["Allocation workflow<br/>[LeaveAllocation]"]
  node_type_features["Leave type workflow<br/>[LeaveType]"]
  node_identity_contracts["Identity contracts<br/>[Identity]"]
end

subgraph group_domain["Domain model"]
  node_leave_entities["Leave entities<br/>[LeaveRequest.cs]"]
end

subgraph group_services["Identity and infrastructure"]
  node_identity_service["Identity service<br/>[AuthService.cs]"]
  node_email["Email sender<br/>[EmailSender.cs]"]
end

subgraph group_persistence["Persistence"]
  node_repositories["Leave repositories<br/>[Repositories]"]
  node_db_context[("Leave database")]
end

node_people(("Employees and admins"))

node_people -->|"uses"| node_blazor
node_blazor -.->|"sends requests"| node_api_host
node_ui_auth -.->|"authenticates through"| node_auth_api
node_api_host -.->|"hosts"| node_auth_api
node_api_host -.->|"hosts"| node_leave_api
node_api_host -.->|"hosts"| node_alloc_api
node_api_host -.->|"hosts"| node_type_api
node_leave_api -->|"dispatches"| node_request_features
node_alloc_api -.->|"dispatches"| node_allocation_features
node_type_api -.->|"dispatches"| node_type_features
node_auth_api -.->|"uses"| node_identity_service
node_request_features -.->|"reads and writes"| node_repositories
node_allocation_features -.->|"reads and writes"| node_repositories
node_type_features -.->|"reads and writes"| node_repositories
node_request_features -->|"gets employee details"| node_identity_contracts
node_identity_service -->|"implements"| node_identity_contracts
node_repositories -.->|"uses"| node_db_context
node_db_context -->|"persists"| node_leave_entities
node_people -.->|"receives notifications"| node_email

click node_blazor "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.BlazorUI"
click node_ui_auth "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.BlazorUI/Services/AuthenticationService.cs"
click node_api_host "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Program.cs"
click node_auth_api "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/AuthController.cs"
click node_leave_api "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveRequestsController.cs"
click node_alloc_api "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveAllocationsController.cs"
click node_type_api "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveTypesController.cs"
click node_request_features "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveRequest"
click node_allocation_features "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveAllocation"
click node_type_features "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveType"
click node_identity_contracts "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Contracts/Identity"
click node_leave_entities "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Domain/LeaveRequest.cs"
click node_identity_service "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Identity/Services/AuthService.cs"
click node_email "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Infrastructure/EmailService/EmailSender.cs"
click node_repositories "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Persistence/Repositories"
click node_db_context "https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Persistence/DatabaseContext/HrDatabaseContext.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_blazor,node_ui_auth toneBlue
class node_api_host,node_auth_api,node_leave_api,node_alloc_api,node_type_api toneAmber
class node_request_features,node_allocation_features,node_type_features,node_identity_contracts toneMint
class node_leave_entities toneRose
class node_identity_service,node_email,node_people toneIndigo
class node_repositories,node_db_context toneTeal
```

## Components

### Blazor client

- [Blazor UI](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.BlazorUI): `HR.LeaveManagement.BlazorUI`
- [Client authentication](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.BlazorUI/Services/AuthenticationService.cs): `HR.LeaveManagement.BlazorUI/Services/AuthenticationService.cs`

### API boundary

- [API host](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Program.cs): `HR.LeaveManagement.Api/Program.cs`
- [Authentication endpoints](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/AuthController.cs): `HR.LeaveManagement.Api/Controllers/AuthController.cs`
- [Leave endpoints](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveRequestsController.cs): `HR.LeaveManagement.Api/Controllers/LeaveRequestsController.cs`
- [Allocation endpoints](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveAllocationsController.cs): `HR.LeaveManagement.Api/Controllers/LeaveAllocationsController.cs`
- [Leave type endpoints](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Api/Controllers/LeaveTypesController.cs): `HR.LeaveManagement.Api/Controllers/LeaveTypesController.cs`

### Application features

- [Request workflow](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveRequest): `HR.LeaveManagement.Application/Features/LeaveRequest`
- [Allocation workflow](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveAllocation): `HR.LeaveManagement.Application/Features/LeaveAllocation`
- [Leave type workflow](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Features/LeaveType): `HR.LeaveManagement.Application/Features/LeaveType`
- [Identity contracts](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Application/Contracts/Identity): `HR.LeaveManagement.Application/Contracts/Identity`

### Domain model

- [Leave entities](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Domain/LeaveRequest.cs): `HR.LeaveManagement.Domain/LeaveRequest.cs`

### Identity and infrastructure

- [Identity service](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Identity/Services/AuthService.cs): `HR.LeaveManagement.Identity/Services/AuthService.cs`
- [Email sender](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Infrastructure/EmailService/EmailSender.cs): `HR.LeaveManagement.Infrastructure/EmailService/EmailSender.cs`

### Persistence

- [Leave repositories](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/tree/main/HR.LeaveManagement.Persistence/Repositories): `HR.LeaveManagement.Persistence/Repositories`
- [Leave database](https://github.com/ahmadabdelbary2001/hr.leavemanagement.clean/blob/main/HR.LeaveManagement.Persistence/DatabaseContext/HrDatabaseContext.cs): `HR.LeaveManagement.Persistence/DatabaseContext/HrDatabaseContext.cs`

### Other components

- **Employees and admins**

## Connections

- Employees and admins → Blazor UI: uses (evidence: `README.md`)
- Blazor UI → API host: sends requests
- Client authentication → Authentication endpoints: authenticates through
- API host → Authentication endpoints: hosts
- API host → Leave endpoints: hosts
- API host → Allocation endpoints: hosts
- API host → Leave type endpoints: hosts
- Leave endpoints → Request workflow: dispatches (evidence: `HR.LeaveManagement.Api/Controllers/LeaveRequestsController.cs`)
- Allocation endpoints → Allocation workflow: dispatches (evidence: `HR.LeaveManagement.Api/Controllers/LeaveAllocationsController.cs`)
- Leave type endpoints → Leave type workflow: dispatches
- Authentication endpoints → Identity service: uses
- Request workflow → Leave repositories: reads and writes
- Allocation workflow → Leave repositories: reads and writes
- Leave type workflow → Leave repositories: reads and writes
- Request workflow → Identity contracts: gets employee details (evidence: `HR.LeaveManagement.Application/Features/LeaveRequest/Queries/GetLeaveRequestDetail/GetLeaveRequestDetailQueryHandler.cs`)
- Identity service → Identity contracts: implements (evidence: `HR.LeaveManagement.Identity/Services/AuthService.cs`)
- Leave repositories → Leave database: uses (evidence: `HR.LeaveManagement.Persistence/Repositories/LeaveAllocationRepository.cs`)
- Leave database → Leave entities: persists (evidence: `HR.LeaveManagement.Persistence/DatabaseContext/HrDatabaseContext.cs`)
- Employees and admins → Email sender: receives notifications
