# andyhacool/hrm architecture

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

- Interactive diagram: https://gitdiagram.com/andyhacool/hrm
- Repository: https://github.com/andyhacool/hrm

## Overview

HRM System is a .NET Core backend for workforce and account management. The evidenced user workflow is an HTTP account request through AccountController and AccountAppService to authentication handlers, which use identity and persistence components and return responses. The repository also defines employee commands, domain events, and event-sourcing components, although the sampled employee command handler is unimplemented and no employee API route appears in the tree. Edges are limited to visible calls and explicit handler responsibilities; unsampled wiring is not inferred.

Main entry points: [`src/HRM.Application/Services/AccountAppService.cs`](https://github.com/andyhacool/hrm/blob/master/src/HRM.Application/Services/AccountAppService.cs) (Account app service), [`src/HRM.Infra.CrossCutting.Identity/AuthHandlers/ExchangeRefreshTokenHandler.cs`](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/ExchangeRefreshTokenHandler.cs) (Refresh handler), [`src/HRM.Domain/CommandHandlers/EmployeeCommandHandler.cs`](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/CommandHandlers/EmployeeCommandHandler.cs) (Employee command handler), [`src/HRM.WebApi/Controllers/AccountController.cs`](https://github.com/andyhacool/hrm/blob/master/src/HRM.WebApi/Controllers/AccountController.cs) (Account controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Web API"]
  node_account_controller["Account controller"]
end

subgraph group_application["Application"]
  node_account_service["Account app service"]
end

subgraph group_identity["Identity"]
  node_login_handler["Login handler<br/>[LoginHandler.cs]"]
  node_refresh_handler["Refresh handler"]
  node_register_handler["Registration handler"]
  node_jwt_services["JWT services<br/>[JwtFactory.cs]"]
  node_user_repository["User repository<br/>[UserRepository.cs]"]
  node_identity_context[("Identity context")]
end

subgraph group_domain["Employee Domain"]
  node_employee_commands["Employee commands<br/>[EmployeeCommand.cs]"]
  node_employee_validation["Command validation"]
  node_employee_handler["Employee command handler"]
  node_employee_entity["Employee entity<br/>[Employee.cs]"]
  node_employee_events["Employee domain events"]
end

subgraph group_persistence["Persistence"]
  node_employee_repository["Employee repository"]
  node_unit_of_work["Unit of work<br/>[UnitOfWork.cs]"]
  node_hrm_context[("HRM database context<br/>[HRMContext.cs]")]
  node_event_store[("SQL event store<br/>[SqlEventStore.cs]")]
  node_event_context[("Event store context")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_account_controller
node_account_controller -->|"calls account service"| node_account_service
node_account_service -->|"handles login"| node_login_handler
node_account_service -->|"exchanges token"| node_refresh_handler
node_account_service -->|"handles registration"| node_register_handler
node_refresh_handler -->|"loads and updates user"| node_user_repository
node_refresh_handler -->|"validates and issues tokens"| node_jwt_services
node_user_repository -->|"uses identity store"| node_identity_context
node_employee_commands -->|"validated by"| node_employee_validation
node_employee_handler -->|"uses repository"| node_employee_repository
node_employee_handler -->|"commits changes"| node_unit_of_work
node_employee_repository -->|"persists employees"| node_hrm_context
node_event_store -->|"stores events"| node_event_context

click node_account_controller "https://github.com/andyhacool/hrm/blob/master/src/HRM.WebApi/Controllers/AccountController.cs"
click node_account_service "https://github.com/andyhacool/hrm/blob/master/src/HRM.Application/Services/AccountAppService.cs"
click node_login_handler "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/LoginHandler.cs"
click node_refresh_handler "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/ExchangeRefreshTokenHandler.cs"
click node_register_handler "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/RegisterUserHandler.cs"
click node_jwt_services "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Auth/JwtFactory.cs"
click node_user_repository "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Repositories/UserRepository.cs"
click node_identity_context "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Models/AppIdentityDbContext.cs"
click node_employee_commands "https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Commands/EmployeeCommand.cs"
click node_employee_validation "https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Validations/RegisterNewEmployeeCommandValidation.cs"
click node_employee_handler "https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/CommandHandlers/EmployeeCommandHandler.cs"
click node_employee_entity "https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Entities/Employee.cs"
click node_employee_events "https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Events/EmployeeRegisteredEvent.cs"
click node_employee_repository "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Repository/EmployeeRepository.cs"
click node_unit_of_work "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/UoW/UnitOfWork.cs"
click node_hrm_context "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Context/HRMContext.cs"
click node_event_store "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/EventSourcing/SqlEventStore.cs"
click node_event_context "https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Context/EventSourcingContext.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_account_controller,node_client toneBlue
class node_account_service toneAmber
class node_login_handler,node_refresh_handler,node_register_handler,node_jwt_services,node_user_repository,node_identity_context toneMint
class node_employee_commands,node_employee_validation,node_employee_handler,node_employee_entity,node_employee_events toneRose
class node_employee_repository,node_unit_of_work,node_hrm_context,node_event_store,node_event_context toneIndigo
```

## Components

### Web API

- [Account controller](https://github.com/andyhacool/hrm/blob/master/src/HRM.WebApi/Controllers/AccountController.cs): `src/HRM.WebApi/Controllers/AccountController.cs`

### Application

- [Account app service](https://github.com/andyhacool/hrm/blob/master/src/HRM.Application/Services/AccountAppService.cs): `src/HRM.Application/Services/AccountAppService.cs`

### Identity

- [Login handler](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/LoginHandler.cs): `src/HRM.Infra.CrossCutting.Identity/AuthHandlers/LoginHandler.cs`
- [Refresh handler](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/ExchangeRefreshTokenHandler.cs): `src/HRM.Infra.CrossCutting.Identity/AuthHandlers/ExchangeRefreshTokenHandler.cs`
- [Registration handler](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/AuthHandlers/RegisterUserHandler.cs): `src/HRM.Infra.CrossCutting.Identity/AuthHandlers/RegisterUserHandler.cs`
- [JWT services](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Auth/JwtFactory.cs): `src/HRM.Infra.CrossCutting.Identity/Auth/JwtFactory.cs`
- [User repository](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Repositories/UserRepository.cs): `src/HRM.Infra.CrossCutting.Identity/Repositories/UserRepository.cs`
- [Identity context](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.CrossCutting.Identity/Models/AppIdentityDbContext.cs): `src/HRM.Infra.CrossCutting.Identity/Models/AppIdentityDbContext.cs`

### Employee Domain

- [Employee commands](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Commands/EmployeeCommand.cs): `src/HRM.Domain/Commands/EmployeeCommand.cs`
- [Command validation](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Validations/RegisterNewEmployeeCommandValidation.cs): `src/HRM.Domain/Validations/RegisterNewEmployeeCommandValidation.cs`
- [Employee command handler](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/CommandHandlers/EmployeeCommandHandler.cs): `src/HRM.Domain/CommandHandlers/EmployeeCommandHandler.cs`
- [Employee entity](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Entities/Employee.cs): `src/HRM.Domain/Entities/Employee.cs`
- [Employee domain events](https://github.com/andyhacool/hrm/blob/master/src/HRM.Domain/Events/EmployeeRegisteredEvent.cs): `src/HRM.Domain/Events/EmployeeRegisteredEvent.cs`

### Persistence

- [Employee repository](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Repository/EmployeeRepository.cs): `src/HRM.Infra.Data/Repository/EmployeeRepository.cs`
- [Unit of work](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/UoW/UnitOfWork.cs): `src/HRM.Infra.Data/UoW/UnitOfWork.cs`
- [HRM database context](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Context/HRMContext.cs): `src/HRM.Infra.Data/Context/HRMContext.cs`
- [SQL event store](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/EventSourcing/SqlEventStore.cs): `src/HRM.Infra.Data/EventSourcing/SqlEventStore.cs`
- [Event store context](https://github.com/andyhacool/hrm/blob/master/src/HRM.Infra.Data/Context/EventSourcingContext.cs): `src/HRM.Infra.Data/Context/EventSourcingContext.cs`

### Other components

- **API client**

## Connections

- API client → Account controller: sends requests
- Account controller → Account app service: calls account service
- Account app service → Login handler: handles login
- Account app service → Refresh handler: exchanges token
- Account app service → Registration handler: handles registration
- Refresh handler → User repository: loads and updates user
- Refresh handler → JWT services: validates and issues tokens
- User repository → Identity context: uses identity store
- Employee commands → Command validation: validated by
- Employee command handler → Employee repository: uses repository
- Employee command handler → Unit of work: commits changes
- Employee repository → HRM database context: persists employees
- SQL event store → Event store context: stores events
