# somvanshitechnologies/somvanshi_hrms architecture

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

- Interactive diagram: https://gitdiagram.com/somvanshitechnologies/somvanshi_hrms
- Repository: https://github.com/somvanshitechnologies/somvanshi_hrms

## Overview

Somvanshi HRMS is a full-stack employee-lifecycle platform: users enter through the React application, authenticate and pass role-based access checks, then use HR modules for hiring, onboarding, work, growth, pay, and exit. The backend mounts bounded modules behind a central API router; modules use Prisma for persistence, while selected workflows emit audit records and notifications. The README documents the broader module capabilities, but most domain implementations and frontend-to-API calls were not sampled, so those relationships are cited as documentation rather than inspected source.

Main entry points: [`backend/src/routes.ts`](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/routes.ts) (API router), [`backend/src/config/db.ts`](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/config/db.ts) (Prisma gateway), [`backend/src/modules/performance/performance.routes.ts`](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/performance/performance.routes.ts) (Performance), [`backend/src/modules/exit/exit.routes.ts`](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/exit/exit.routes.ts) (Exit and settlement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["HR application<br/>[router.tsx]"]
  node_api["API router<br/>[routes.ts]"]
end

subgraph group_access["Identity and access"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_token["Token service<br/>[token.service.ts]"]
  node_authguard["Auth guard<br/>[auth.middleware.ts]"]
  node_rbac["Permission checks<br/>[rbac.middleware.ts]"]
  node_permissions["Role catalog<br/>[permissions.ts]"]
end

subgraph group_people["People lifecycle"]
  node_recruitment["Recruitment"]
  node_onboarding["Onboarding"]
  node_employees["Employee records"]
  node_profile["Profile self-service"]
end

subgraph group_work["Work and growth"]
  node_attendance["Attendance"]
  node_leave["Leave"]
  node_payroll["Payroll"]
  node_performance["Performance"]
  node_exit["Exit and settlement<br/>[exit.routes.ts]"]
end

subgraph group_platform["Platform services"]
  node_database[("MySQL database")]
  node_dbclient["Prisma gateway<br/>[db.ts]"]
  node_audit["Audit trail<br/>[audit.service.ts]"]
  node_notifications["Notifications"]
  node_somai["SomAI assistant"]
end

node_employee(("HR user"))

node_employee -->|"uses"| node_webapp
node_webapp -->|"requests HR services"| node_api
node_api -->|"mounts routes"| node_auth
node_api -->|"mounts routes"| node_recruitment
node_api -->|"mounts routes"| node_onboarding
node_api -->|"mounts routes"| node_employees
node_api -->|"mounts routes"| node_profile
node_api -->|"mounts routes"| node_attendance
node_api -->|"mounts routes"| node_leave
node_api -->|"mounts routes"| node_payroll
node_api -->|"mounts routes"| node_performance
node_api -->|"mounts routes"| node_exit
node_api -->|"mounts routes"| node_somai
node_auth -->|"issues tokens"| node_token
node_authguard -->|"verifies tokens"| node_token
node_rbac -->|"uses permission types"| node_permissions
node_employees -->|"reads and writes"| node_dbclient
node_performance -->|"records changes"| node_audit
node_performance -->|"notifies reviewers"| node_notifications
node_exit -->|"records changes"| node_audit
node_exit -->|"notifies participants"| node_notifications
node_dbclient -->|"persists records"| node_database
node_recruitment -->|"persists hiring data"| node_dbclient
node_onboarding -->|"persists joining data"| node_dbclient
node_attendance -->|"persists time data"| node_dbclient
node_leave -->|"persists leave data"| node_dbclient
node_payroll -->|"persists payroll data"| node_dbclient
node_somai -->|"assists user"| node_employee

click node_webapp "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/frontend/src/app/router.tsx"
click node_api "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/routes.ts"
click node_auth "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/auth/auth.service.ts"
click node_token "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/auth/token.service.ts"
click node_authguard "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/middleware/auth.middleware.ts"
click node_rbac "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/middleware/rbac.middleware.ts"
click node_permissions "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/shared/permissions.ts"
click node_recruitment "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/recruitment"
click node_onboarding "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/onboarding"
click node_employees "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/employees/employees.routes.ts"
click node_profile "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/profile"
click node_attendance "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/attendance/attendance.service.ts"
click node_leave "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/leave"
click node_payroll "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/payroll"
click node_performance "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/performance/performance.routes.ts"
click node_exit "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/exit/exit.routes.ts"
click node_dbclient "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/config/db.ts"
click node_audit "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/audit/audit.service.ts"
click node_notifications "https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/notifications/notifications.service.ts"
click node_somai "https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/ai"

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_webapp,node_api,node_employee toneBlue
class node_auth,node_token,node_authguard,node_rbac,node_permissions toneAmber
class node_recruitment,node_onboarding,node_employees,node_profile toneMint
class node_attendance,node_leave,node_payroll,node_performance,node_exit toneRose
class node_database,node_dbclient,node_audit,node_notifications,node_somai toneIndigo
```

## Components

### User experience

- [HR application](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/frontend/src/app/router.tsx): `frontend/src/app/router.tsx`
- [API router](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/routes.ts): `backend/src/routes.ts`

### Identity and access

- [Authentication](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/auth/auth.service.ts): `backend/src/modules/auth/auth.service.ts`
- [Token service](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/auth/token.service.ts): `backend/src/modules/auth/token.service.ts`
- [Auth guard](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/middleware/auth.middleware.ts): `backend/src/middleware/auth.middleware.ts`
- [Permission checks](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/middleware/rbac.middleware.ts): `backend/src/middleware/rbac.middleware.ts`
- [Role catalog](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/shared/permissions.ts): `backend/src/shared/permissions.ts`

### People lifecycle

- [Recruitment](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/recruitment): `backend/src/modules/recruitment`
- [Onboarding](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/onboarding): `backend/src/modules/onboarding`
- [Employee records](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/employees/employees.routes.ts): `backend/src/modules/employees/employees.routes.ts`
- [Profile self-service](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/profile): `backend/src/modules/profile`

### Work and growth

- [Attendance](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/attendance/attendance.service.ts): `backend/src/modules/attendance/attendance.service.ts`
- [Leave](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/leave): `backend/src/modules/leave`
- [Payroll](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/payroll): `backend/src/modules/payroll`
- [Performance](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/performance/performance.routes.ts): `backend/src/modules/performance/performance.routes.ts`
- [Exit and settlement](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/exit/exit.routes.ts): `backend/src/modules/exit/exit.routes.ts`

### Platform services

- **MySQL database**
- [Prisma gateway](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/config/db.ts): `backend/src/config/db.ts`
- [Audit trail](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/audit/audit.service.ts): `backend/src/modules/audit/audit.service.ts`
- [Notifications](https://github.com/somvanshitechnologies/somvanshi_hrms/blob/main/backend/src/modules/notifications/notifications.service.ts): `backend/src/modules/notifications/notifications.service.ts`
- [SomAI assistant](https://github.com/somvanshitechnologies/somvanshi_hrms/tree/main/backend/src/modules/ai): `backend/src/modules/ai`

### Other components

- **HR user**

## Connections

- HR user → HR application: uses (evidence: `README.md`)
- HR application → API router: requests HR services (evidence: `README.md`)
- API router → Authentication: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Recruitment: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Onboarding: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Employee records: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Profile self-service: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Attendance: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Leave: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Payroll: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Performance: mounts routes (evidence: `backend/src/routes.ts`)
- API router → Exit and settlement: mounts routes (evidence: `backend/src/routes.ts`)
- API router → SomAI assistant: mounts routes (evidence: `backend/src/routes.ts`)
- Authentication → Token service: issues tokens (evidence: `backend/src/modules/auth/auth.service.ts`)
- Auth guard → Token service: verifies tokens (evidence: `backend/src/middleware/auth.middleware.ts`)
- Permission checks → Role catalog: uses permission types (evidence: `backend/src/middleware/rbac.middleware.ts`)
- Employee records → Prisma gateway: reads and writes (evidence: `backend/src/modules/employees/employees.routes.ts`)
- Performance → Audit trail: records changes (evidence: `backend/src/modules/performance/performance.routes.ts`)
- Performance → Notifications: notifies reviewers (evidence: `backend/src/modules/performance/performance.routes.ts`)
- Exit and settlement → Audit trail: records changes (evidence: `backend/src/modules/exit/exit.routes.ts`)
- Exit and settlement → Notifications: notifies participants (evidence: `backend/src/modules/exit/exit.routes.ts`)
- Prisma gateway → MySQL database: persists records (evidence: `backend/src/config/db.ts`)
- Recruitment → Prisma gateway: persists hiring data (evidence: `README.md`)
- Onboarding → Prisma gateway: persists joining data (evidence: `README.md`)
- Attendance → Prisma gateway: persists time data (evidence: `README.md`)
- Leave → Prisma gateway: persists leave data (evidence: `README.md`)
- Payroll → Prisma gateway: persists payroll data (evidence: `README.md`)
- SomAI assistant → HR user: assists user (evidence: `README.md`)
