# lakshman1419/hrassistant architecture

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

- Interactive diagram: https://gitdiagram.com/lakshman1419/hrassistant
- Repository: https://github.com/lakshman1419/hrassistant

## Overview

This repository is an HR assistant with an Angular client and ASP.NET API. Users log in, then ask HR questions; the API delegates to an agent that can retrieve employee details, leave balances, or policy excerpts before returning an answer. Policy PDFs are extracted, chunked, and indexed at startup for semantic search. The graph includes the documented authentication and policy-search wiring; some service internals and the client-to-chat API connection were not shown, so uncertain links are omitted or marked unverified.

Main entry points: [`HrAssistant/Program.cs`](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Program.cs) (Application startup), [`HrAssistant/Services/HrToolRegistry.cs`](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/HrToolRegistry.cs) (Tool registry), [`ClientApp/src/app/services/auth.service.ts`](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/services/auth.service.ts) (Client authentication), [`HrAssistant/Controllers/AuthController.cs`](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Controllers/AuthController.cs) (Login API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_login["Login screen<br/>[login.component.ts]"]
  node_authui["Client authentication<br/>[auth.service.ts]"]
  node_guard["Route guard<br/>[auth.guard.ts]"]
  node_chat["Assistant screen"]
  node_chatapi["HR assistant client service"]
end

subgraph group_api["API and authentication"]
  node_authcontroller["Login API<br/>[AuthController.cs]"]
  node_authservice["Credential authentication"]
  node_authconfig["Authentication configuration"]
  node_startup["Application startup<br/>[Program.cs]"]
end

subgraph group_assistant["HR assistant"]
  node_hrcontroller["HR API<br/>[HrController.cs]"]
  node_agent["HR agent<br/>[HrAgent.cs]"]
  node_registry["Tool registry<br/>[HrToolRegistry.cs]"]
  node_employeetool["Employee lookup tool<br/>[EmployeeTools.cs]"]
  node_leavetool["Leave balance tool<br/>[LeaveTools.cs]"]
  node_employeedata["Employee service<br/>[EmployeeService.cs]"]
  node_leavedata["Leave service<br/>[LeaveService.cs]"]
end

subgraph group_policy["Policy retrieval"]
  node_policytool["Policy search tool<br/>[PolicyTools.cs]"]
  node_pdf["PDF extraction<br/>[PdfService.cs]"]
  node_chunk["Text chunking"]
  node_vector[("Policy vector store")]
  node_embedding["Embedding client"]
end

node_employee(("HR user"))
node_nvidia{{"NVIDIA API"}}

node_employee -->|"enters credentials"| node_login
node_login -->|"submits login"| node_authui
node_authui -->|"posts credentials"| node_authcontroller
node_authcontroller -->|"authenticates"| node_authservice
node_authservice -->|"reads users"| node_authconfig
node_authui -->|"provides session"| node_guard
node_employee -->|"asks HR question"| node_chat
node_chat -->|"uses service"| node_chatapi
node_chatapi -.->|"sends question"| node_hrcontroller
node_hrcontroller -->|"delegates question"| node_agent
node_agent -->|"dispatches tools"| node_registry
node_registry -->|"registers"| node_employeetool
node_registry -->|"registers"| node_leavetool
node_registry -->|"registers"| node_policytool
node_leavetool -->|"gets balance"| node_leavedata
node_policytool -->|"searches policies"| node_vector
node_startup -->|"extracts PDFs"| node_pdf
node_startup -->|"splits text"| node_chunk
node_startup -->|"indexes chunks"| node_vector
node_vector -->|"creates vectors"| node_embedding
node_embedding -->|"requests embeddings"| node_nvidia
node_startup -->|"maps controllers"| node_authcontroller
node_startup -->|"registers agent"| node_agent

click node_login "https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/components/login/login.component.ts"
click node_authui "https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/services/auth.service.ts"
click node_guard "https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/auth.guard.ts"
click node_chat "https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/components/hr-assistant/hr-assistant.component.ts"
click node_chatapi "https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/services/hr-assistant.service.ts"
click node_authcontroller "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Controllers/AuthController.cs"
click node_authservice "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/InMemoryUserAuthenticationService.cs"
click node_authconfig "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Models/AuthenticationOptions.cs"
click node_hrcontroller "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Controllers/HrController.cs"
click node_agent "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Agents/HrAgent.cs"
click node_registry "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/HrToolRegistry.cs"
click node_employeetool "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/EmployeeTools.cs"
click node_leavetool "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/LeaveTools.cs"
click node_employeedata "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/EmployeeService.cs"
click node_leavedata "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/LeaveService.cs"
click node_policytool "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/PolicyTools.cs"
click node_pdf "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/PdfService.cs"
click node_chunk "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/TextChunkService.cs"
click node_vector "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/VectorStoreService.cs"
click node_embedding "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/NvidiaEmbeddingService.cs"
click node_startup "https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/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_login,node_authui,node_guard,node_chat,node_chatapi,node_employee toneBlue
class node_authcontroller,node_authservice,node_authconfig,node_startup toneAmber
class node_hrcontroller,node_agent,node_registry,node_employeetool,node_leavetool,node_employeedata,node_leavedata,node_nvidia toneMint
class node_policytool,node_pdf,node_chunk,node_vector,node_embedding toneRose
```

## Components

### Angular client

- [Login screen](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/components/login/login.component.ts): `ClientApp/src/app/components/login/login.component.ts`
- [Client authentication](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/services/auth.service.ts): `ClientApp/src/app/services/auth.service.ts`
- [Route guard](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/auth.guard.ts): `ClientApp/src/app/auth.guard.ts`
- [Assistant screen](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/components/hr-assistant/hr-assistant.component.ts): `ClientApp/src/app/components/hr-assistant/hr-assistant.component.ts`
- [HR assistant client service](https://github.com/lakshman1419/hrassistant/blob/master/ClientApp/src/app/services/hr-assistant.service.ts): `ClientApp/src/app/services/hr-assistant.service.ts`

### API and authentication

- [Login API](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Controllers/AuthController.cs): `HrAssistant/Controllers/AuthController.cs`
- [Credential authentication](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/InMemoryUserAuthenticationService.cs): `HrAssistant/Services/InMemoryUserAuthenticationService.cs`
- [Authentication configuration](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Models/AuthenticationOptions.cs): `HrAssistant/Models/AuthenticationOptions.cs`
- [Application startup](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Program.cs): `HrAssistant/Program.cs`

### HR assistant

- [HR API](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Controllers/HrController.cs): `HrAssistant/Controllers/HrController.cs`
- [HR agent](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Agents/HrAgent.cs): `HrAssistant/Agents/HrAgent.cs`
- [Tool registry](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/HrToolRegistry.cs): `HrAssistant/Services/HrToolRegistry.cs`
- [Employee lookup tool](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/EmployeeTools.cs): `HrAssistant/Tools/EmployeeTools.cs`
- [Leave balance tool](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/LeaveTools.cs): `HrAssistant/Tools/LeaveTools.cs`
- [Employee service](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/EmployeeService.cs): `HrAssistant/Services/EmployeeService.cs`
- [Leave service](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/LeaveService.cs): `HrAssistant/Services/LeaveService.cs`

### Policy retrieval

- [Policy search tool](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Tools/PolicyTools.cs): `HrAssistant/Tools/PolicyTools.cs`
- [PDF extraction](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/PdfService.cs): `HrAssistant/Services/PdfService.cs`
- [Text chunking](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/TextChunkService.cs): `HrAssistant/Services/TextChunkService.cs`
- [Policy vector store](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/VectorStoreService.cs): `HrAssistant/Services/VectorStoreService.cs`
- [Embedding client](https://github.com/lakshman1419/hrassistant/blob/master/HrAssistant/Services/NvidiaEmbeddingService.cs): `HrAssistant/Services/NvidiaEmbeddingService.cs`

### Other components

- **HR user**
- **NVIDIA API**

## Connections

- HR user → Login screen: enters credentials
- Login screen → Client authentication: submits login (evidence: `ClientApp/src/app/components/login/login.component.ts`)
- Client authentication → Login API: posts credentials (evidence: `ClientApp/src/app/services/auth.service.ts`)
- Login API → Credential authentication: authenticates (evidence: `HrAssistant/Controllers/AuthController.cs`)
- Credential authentication → Authentication configuration: reads users (evidence: `HrAssistant/Services/InMemoryUserAuthenticationService.cs`)
- Client authentication → Route guard: provides session (evidence: `ClientApp/src/app/auth.guard.ts`)
- HR user → Assistant screen: asks HR question
- Assistant screen → HR assistant client service: uses service (evidence: `ClientApp/src/app/components/hr-assistant/hr-assistant.component.ts`)
- HR assistant client service → HR API: sends question
- HR API → HR agent: delegates question (evidence: `HrAssistant/Controllers/HrController.cs`)
- HR agent → Tool registry: dispatches tools (evidence: `HrAssistant/Agents/HrAgent.cs`)
- Tool registry → Employee lookup tool: registers (evidence: `HrAssistant/Services/HrToolRegistry.cs`)
- Tool registry → Leave balance tool: registers (evidence: `HrAssistant/Services/HrToolRegistry.cs`)
- Tool registry → Policy search tool: registers (evidence: `HrAssistant/Services/HrToolRegistry.cs`)
- Leave balance tool → Leave service: gets balance (evidence: `HrAssistant/Tools/LeaveTools.cs`)
- Policy search tool → Policy vector store: searches policies (evidence: `HrAssistant/Tools/PolicyTools.cs`)
- Application startup → PDF extraction: extracts PDFs (evidence: `HrAssistant/Program.cs`)
- Application startup → Text chunking: splits text (evidence: `HrAssistant/Program.cs`)
- Application startup → Policy vector store: indexes chunks (evidence: `HrAssistant/Program.cs`)
- Policy vector store → Embedding client: creates vectors (evidence: `HrAssistant/Services/VectorStoreService.cs`)
- Embedding client → NVIDIA API: requests embeddings (evidence: `HrAssistant/Services/NvidiaEmbeddingService.cs`)
- Application startup → Login API: maps controllers (evidence: `HrAssistant/Program.cs`)
- Application startup → HR agent: registers agent (evidence: `HrAssistant/Program.cs`)
