# thanmaykh/ai-hrms architecture

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

- Interactive diagram: https://gitdiagram.com/thanmaykh/ai-hrms
- Repository: https://github.com/thanmaykh/ai-hrms

## Overview

Enterprise HRMS serves employees, recruiters, and administrators through role-based dashboards and APIs. The main hiring workflow is job setup and publication, candidate application, AI resume evaluation, and recruiter review with human override and audit records. Separate product branches cover employee administration, attendance, leave, payroll and payslips, performance reviews, responsible-AI controls, chatbot assistance, and reporting. Source excerpts establish the cited calls; other major README capabilities remain as subsystem nodes where implementation details were not sampled.

Main entry points: [`src/lib/db.ts`](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/db.ts) (Application database), [`src/lib/auth.ts`](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/auth.ts) (Session identity), [`src/app/api/ai/analyze-resume/route.ts`](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/analyze-resume/route.ts) (AI resume screening), [`src/lib/ai/llm.ts`](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/llm.ts) (LLM engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hiring["Hiring &amp; AI screening"]
  node_job_ops["Job management<br/>[route.ts]"]
  node_applications["Applications<br/>[route.ts]"]
  node_resume_upload["Resume upload<br/>[ResumeUploader.tsx]"]
  node_resume_parse["Resume parsing<br/>[route.ts]"]
  node_resume_analysis["AI resume screening<br/>[route.ts]"]
  node_llm["LLM engine<br/>[llm.ts]"]
  node_ai_review["Recruiter review<br/>[route.ts]"]
end

subgraph group_workforce["Workforce operations"]
  node_employee_admin["Employee records<br/>[route.ts]"]
  node_attendance["Shift attendance<br/>[route.ts]"]
  node_leave["Leave workflows<br/>[route.ts]"]
  node_payroll["Payroll &amp; payslips<br/>[route.ts]"]
  node_performance["Performance matrix<br/>[route.ts]"]
  node_exports["CSV reports<br/>[route.ts]"]
end

subgraph group_assurance["Responsible AI"]
  node_ai_governance["AI governance<br/>[governance.ts]"]
  node_data_quality["Data quality checks<br/>[data-quality.ts]"]
  node_ai_controls["Responsible-AI controls<br/>[route.ts]"]
end

subgraph group_experience["User experience"]
  node_chatbot["HR chatbot<br/>[route.ts]"]
  node_dashboard_ui["Role dashboards<br/>[layout.tsx]"]
  node_header["Header &amp; navigation<br/>[Header.tsx]"]
  node_command_palette["Command palette<br/>[CommandPalette.tsx]"]
  node_notifications_ui["Notification bell"]
end

subgraph group_platform["Identity &amp; data"]
  node_auth["Session identity<br/>[auth.ts]"]
  node_database[("Application database<br/>[db.ts]")]
end

node_actors(("HRMS users"))
node_openai["OpenAI service"]
node_gemini["Gemini service"]
node_openrouter["OpenRouter service"]

node_actors -.->|"use dashboards"| node_dashboard_ui
node_actors -.->|"manage openings"| node_job_ops
node_actors -.->|"submit application"| node_applications
node_job_ops -->|"reads and writes"| node_database
node_job_ops -->|"checks session"| node_auth
node_applications -->|"checks session"| node_auth
node_applications -->|"checks resume"| node_data_quality
node_applications -->|"stores application"| node_database
node_resume_upload -.->|"uploads resume"| node_resume_parse
node_actors -.->|"request screening"| node_resume_analysis
node_resume_analysis -->|"checks session"| node_auth
node_resume_analysis -->|"checks input"| node_data_quality
node_resume_analysis -->|"requests analysis"| node_llm
node_resume_analysis -->|"calculates confidence"| node_ai_governance
node_resume_analysis -->|"persists analysis"| node_database
node_llm -->|"calls provider"| node_openai
node_llm -->|"calls provider"| node_gemini
node_llm -->|"calls provider"| node_openrouter
node_actors -.->|"review candidates"| node_ai_review
node_ai_review -->|"checks reviewer"| node_auth
node_ai_review -->|"records decision"| node_database
node_ai_review -->|"logs review"| node_ai_governance
node_ai_governance -->|"writes audit"| node_database
node_ai_controls -->|"reads settings"| node_ai_governance
node_actors -.->|"administer staff"| node_employee_admin
node_actors -.->|"clock shifts"| node_attendance
node_actors -.->|"request leave"| node_leave
node_actors -.->|"view payslips"| node_payroll
node_actors -.->|"evaluate talent"| node_performance
node_actors -.->|"export reports"| node_exports
node_employee_admin -->|"checks session"| node_auth
node_employee_admin -->|"reads and writes"| node_database
node_attendance -->|"reads and writes"| node_database
node_leave -->|"reads and writes"| node_database
node_payroll -->|"reads payroll"| node_database
node_performance -->|"stores reviews"| node_database
node_exports -->|"reads report data"| node_database
node_actors -.->|"ask HR questions"| node_chatbot
node_chatbot -->|"requests response"| node_llm
node_chatbot -->|"queries HR data"| node_database
node_header -->|"renders"| node_command_palette
node_header -->|"renders"| node_notifications_ui
node_actors -.->|"sign in"| node_auth
node_auth -->|"loads profile"| node_database

click node_job_ops "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/jobs/route.ts"
click node_applications "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/applications/route.ts"
click node_resume_upload "https://github.com/thanmaykh/ai-hrms/blob/main/src/components/recruitment/ResumeUploader.tsx"
click node_resume_parse "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/parse-resume-pdf/route.ts"
click node_resume_analysis "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/analyze-resume/route.ts"
click node_llm "https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/llm.ts"
click node_ai_review "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai-reviews/route.ts"
click node_employee_admin "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/employees/route.ts"
click node_attendance "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/attendance/route.ts"
click node_leave "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/leaves/route.ts"
click node_payroll "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/payroll/%5Bid%5D/pdf/route.ts"
click node_performance "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/performance/route.ts"
click node_exports "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/reports/export/route.ts"
click node_ai_governance "https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/governance.ts"
click node_data_quality "https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/data-quality.ts"
click node_ai_controls "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/responsible-ai/route.ts"
click node_chatbot "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/chatbot/route.ts"
click node_dashboard_ui "https://github.com/thanmaykh/ai-hrms/blob/main/src/app/(dashboard)/layout.tsx"
click node_header "https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/Header.tsx"
click node_command_palette "https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/CommandPalette.tsx"
click node_notifications_ui "https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/NotificationBell.tsx"
click node_auth "https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/auth.ts"
click node_database "https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/db.ts"

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_job_ops,node_applications,node_resume_upload,node_resume_parse,node_resume_analysis,node_llm,node_ai_review,node_actors toneBlue
class node_employee_admin,node_attendance,node_leave,node_payroll,node_performance,node_exports toneAmber
class node_ai_governance,node_data_quality,node_ai_controls,node_openrouter toneMint
class node_chatbot,node_dashboard_ui,node_header,node_command_palette,node_notifications_ui toneRose
class node_auth,node_database,node_openai,node_gemini toneIndigo
```

## Components

### Hiring & AI screening

- [Job management](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/jobs/route.ts): `src/app/api/jobs/route.ts`
- [Applications](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/applications/route.ts): `src/app/api/applications/route.ts`
- [Resume upload](https://github.com/thanmaykh/ai-hrms/blob/main/src/components/recruitment/ResumeUploader.tsx): `src/components/recruitment/ResumeUploader.tsx`
- [Resume parsing](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/parse-resume-pdf/route.ts): `src/app/api/ai/parse-resume-pdf/route.ts`
- [AI resume screening](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/analyze-resume/route.ts): `src/app/api/ai/analyze-resume/route.ts`
- [LLM engine](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/llm.ts): `src/lib/ai/llm.ts`
- [Recruiter review](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai-reviews/route.ts): `src/app/api/ai-reviews/route.ts`

### Workforce operations

- [Employee records](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/employees/route.ts): `src/app/api/employees/route.ts`
- [Shift attendance](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/attendance/route.ts): `src/app/api/attendance/route.ts`
- [Leave workflows](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/leaves/route.ts): `src/app/api/leaves/route.ts`
- [Payroll & payslips](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/payroll/%5Bid%5D/pdf/route.ts): `src/app/api/payroll/[id]/pdf/route.ts`
- [Performance matrix](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/performance/route.ts): `src/app/api/performance/route.ts`
- [CSV reports](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/reports/export/route.ts): `src/app/api/reports/export/route.ts`

### Responsible AI

- [AI governance](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/governance.ts): `src/lib/ai/governance.ts`
- [Data quality checks](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/ai/data-quality.ts): `src/lib/ai/data-quality.ts`
- [Responsible-AI controls](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/responsible-ai/route.ts): `src/app/api/responsible-ai/route.ts`

### User experience

- [HR chatbot](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/api/ai/chatbot/route.ts): `src/app/api/ai/chatbot/route.ts`
- [Role dashboards](https://github.com/thanmaykh/ai-hrms/blob/main/src/app/(dashboard)/layout.tsx): `src/app/(dashboard)/layout.tsx`
- [Header & navigation](https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/Header.tsx): `src/components/common/Header.tsx`
- [Command palette](https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/CommandPalette.tsx): `src/components/common/CommandPalette.tsx`
- [Notification bell](https://github.com/thanmaykh/ai-hrms/blob/main/src/components/common/NotificationBell.tsx): `src/components/common/NotificationBell.tsx`

### Identity & data

- [Session identity](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Application database](https://github.com/thanmaykh/ai-hrms/blob/main/src/lib/db.ts): `src/lib/db.ts`

### Other components

- **HRMS users**
- **OpenAI service**
- **Gemini service**
- **OpenRouter service**

## Connections

- HRMS users → Role dashboards: use dashboards
- HRMS users → Job management: manage openings
- HRMS users → Applications: submit application
- Job management → Application database: reads and writes (evidence: `src/app/api/jobs/route.ts`)
- Job management → Session identity: checks session (evidence: `src/app/api/jobs/route.ts`)
- Applications → Session identity: checks session (evidence: `src/app/api/applications/route.ts`)
- Applications → Data quality checks: checks resume (evidence: `src/app/api/applications/route.ts`)
- Applications → Application database: stores application (evidence: `src/app/api/applications/route.ts`)
- Resume upload → Resume parsing: uploads resume
- HRMS users → AI resume screening: request screening
- AI resume screening → Session identity: checks session (evidence: `src/app/api/ai/analyze-resume/route.ts`)
- AI resume screening → Data quality checks: checks input (evidence: `src/app/api/ai/analyze-resume/route.ts`)
- AI resume screening → LLM engine: requests analysis (evidence: `src/app/api/ai/analyze-resume/route.ts`)
- AI resume screening → AI governance: calculates confidence (evidence: `src/app/api/ai/analyze-resume/route.ts`)
- AI resume screening → Application database: persists analysis (evidence: `src/app/api/ai/analyze-resume/route.ts`)
- LLM engine → OpenAI service: calls provider (evidence: `src/lib/ai/llm.ts`)
- LLM engine → Gemini service: calls provider (evidence: `src/lib/ai/llm.ts`)
- LLM engine → OpenRouter service: calls provider (evidence: `src/lib/ai/llm.ts`)
- HRMS users → Recruiter review: review candidates
- Recruiter review → Session identity: checks reviewer (evidence: `src/app/api/ai-reviews/route.ts`)
- Recruiter review → Application database: records decision (evidence: `src/app/api/ai-reviews/route.ts`)
- Recruiter review → AI governance: logs review (evidence: `src/app/api/ai-reviews/route.ts`)
- AI governance → Application database: writes audit (evidence: `src/lib/ai/governance.ts`)
- Responsible-AI controls → AI governance: reads settings (evidence: `src/app/api/responsible-ai/route.ts`)
- HRMS users → Employee records: administer staff
- HRMS users → Shift attendance: clock shifts
- HRMS users → Leave workflows: request leave
- HRMS users → Payroll & payslips: view payslips
- HRMS users → Performance matrix: evaluate talent
- HRMS users → CSV reports: export reports
- Employee records → Session identity: checks session (evidence: `src/app/api/employees/route.ts`)
- Employee records → Application database: reads and writes (evidence: `src/app/api/employees/route.ts`)
- Shift attendance → Application database: reads and writes (evidence: `src/app/api/attendance/route.ts`)
- Leave workflows → Application database: reads and writes (evidence: `src/app/api/leaves/route.ts`)
- Payroll & payslips → Application database: reads payroll (evidence: `src/app/api/payroll/[id]/pdf/route.ts`)
- Performance matrix → Application database: stores reviews (evidence: `src/app/api/performance/route.ts`)
- CSV reports → Application database: reads report data (evidence: `src/app/api/reports/export/route.ts`)
- HRMS users → HR chatbot: ask HR questions
- HR chatbot → LLM engine: requests response (evidence: `src/app/api/ai/chatbot/route.ts`)
- HR chatbot → Application database: queries HR data (evidence: `src/app/api/ai/chatbot/route.ts`)
- Header & navigation → Command palette: renders (evidence: `src/components/common/Header.tsx`)
- Header & navigation → Notification bell: renders (evidence: `src/components/common/Header.tsx`)
- HRMS users → Session identity: sign in
- Session identity → Application database: loads profile (evidence: `src/lib/auth.ts`)
