# rudra512004/hrms architecture

> Architecture diagram of the GitHub repository rudra512004/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/rudra512004/hrms
- Repository: https://github.com/rudra512004/hrms

## Overview

HRMS is a role-controlled human-resources system with a React client and Django REST backend. Users authenticate, enter permission-protected pages, and work across attendance, leave, employee and organization management, payroll, reporting, and administration. Backend domain models hold the HR records; services implement calendar, attendance, authorization, dashboard, payroll, and notification logic. The README establishes the client/API product split but gives few workflow details. Several domain branches are represented from the file tree; their internal calls are omitted where source evidence was not provided.

Main entry points: [`backend/apps/payroll/services.py`](https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/services.py) (Payroll processing), [`frontend/src/routes/AppRouter.tsx`](https://github.com/rudra512004/hrms/blob/main/frontend/src/routes/AppRouter.tsx) (Protected routing), [`backend/apps/attendance/services.py`](https://github.com/rudra512004/hrms/blob/main/backend/apps/attendance/services.py) (Attendance calculations), [`backend/apps/dashboard/services.py`](https://github.com/rudra512004/hrms/blob/main/backend/apps/dashboard/services.py) (Dashboard aggregation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Application shell<br/>[App.tsx]"]
  node_router["Protected routing<br/>[AppRouter.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_authctx["Session context<br/>[AuthContext.tsx]"]
  node_authsvc["Authentication client<br/>[auth.ts]"]
  node_branchctx["Branch context<br/>[BranchContext.tsx]"]
  node_orgclient["Organization client<br/>[organization.ts]"]
  node_access["RBAC services<br/>[services.py]"]
  node_accessdata[("Roles and grants<br/>[models.py]")]
end

subgraph group_workforce["Workforce operations"]
  node_workpages["Attendance and leave"]
  node_adminpages["HR administration"]
  node_employeedata[("Employee records<br/>[models.py]")]
  node_leavedata[("Leave records<br/>[models.py]")]
  node_attenddata[("Attendance records<br/>[models.py]")]
  node_attendancecalc["Attendance calculations<br/>[services.py]"]
  node_orgdata[("Organization structure<br/>[models.py]")]
end

subgraph group_insights["Dashboards and payroll"]
  node_dashboardpage["Dashboard page<br/>[DashboardPage.tsx]"]
  node_dashboard["Dashboard aggregation<br/>[services.py]"]
  node_payrollpage["Payroll management<br/>[PayrollPage.tsx]"]
  node_payrollclient["Payroll client<br/>[payroll.ts]"]
  node_payrollsvc["Payroll processing<br/>[services.py]"]
  node_payrolldata[("Payroll records<br/>[models.py]")]
  node_reports["Payroll reporting"]
end

subgraph group_platform["Shared backend services"]
  node_calendar["Working calendar<br/>[services.py]"]
  node_notify["Notifications<br/>[services.py]"]
  node_audit["Audit logging<br/>[services.py]"]
end

node_user(("HRMS user"))

node_user -.->|"uses"| node_app
node_app -->|"renders"| node_router
node_app -->|"provides session"| node_authctx
node_app -->|"provides branch"| node_branchctx
node_authctx -->|"loads session"| node_authsvc
node_branchctx -->|"reads user"| node_authctx
node_branchctx -->|"lists branches"| node_orgclient
node_access -->|"queries grants"| node_accessdata
node_access -->|"resolves branch"| node_orgdata
node_router -->|"routes to"| node_dashboardpage
node_router -->|"routes to"| node_workpages
node_router -->|"routes to"| node_adminpages
node_router -->|"routes to"| node_payrollpage
node_router -->|"guards routes"| node_authctx
node_attendancecalc -->|"queries"| node_attenddata
node_attendancecalc -->|"uses employee"| node_employeedata
node_attendancecalc -->|"resolves branch"| node_orgdata
node_attendancecalc -->|"checks workdays"| node_calendar
node_attendancecalc -->|"references leave"| node_leavedata
node_calendar -->|"reads calendar"| node_orgdata
node_dashboard -->|"uses permissions"| node_access
node_dashboard -->|"queries attendance"| node_attenddata
node_dashboard -->|"queries leave"| node_leavedata
node_dashboard -->|"queries employees"| node_employeedata
node_payrollpage -->|"uses payroll API"| node_payrollclient
node_payrollsvc -->|"reads attendance"| node_attenddata
node_payrollsvc -->|"reads leave"| node_leavedata
node_payrollsvc -->|"processes payroll"| node_payrolldata
node_payrollsvc -->|"uses organization"| node_orgdata
node_payrollsvc -->|"reads employees"| node_employeedata
node_payrollsvc -->|"sends notices"| node_notify
node_reports -->|"reads payroll"| node_payrolldata
node_reports -->|"reads attendance"| node_attenddata
node_reports -->|"reads leave"| node_leavedata
node_audit -.->|"optional integration"| node_notify

click node_app "https://github.com/rudra512004/hrms/blob/main/frontend/src/App.tsx"
click node_router "https://github.com/rudra512004/hrms/blob/main/frontend/src/routes/AppRouter.tsx"
click node_authctx "https://github.com/rudra512004/hrms/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_authsvc "https://github.com/rudra512004/hrms/blob/main/frontend/src/services/auth.ts"
click node_branchctx "https://github.com/rudra512004/hrms/blob/main/frontend/src/contexts/BranchContext.tsx"
click node_orgclient "https://github.com/rudra512004/hrms/blob/main/frontend/src/services/organization.ts"
click node_access "https://github.com/rudra512004/hrms/blob/main/backend/apps/authorization/services.py"
click node_accessdata "https://github.com/rudra512004/hrms/blob/main/backend/apps/authorization/models.py"
click node_workpages "https://github.com/rudra512004/hrms/tree/main/frontend/src/pages"
click node_adminpages "https://github.com/rudra512004/hrms/tree/main/frontend/src/pages/admin"
click node_employeedata "https://github.com/rudra512004/hrms/blob/main/backend/apps/employees/models.py"
click node_leavedata "https://github.com/rudra512004/hrms/blob/main/backend/apps/leaves/models.py"
click node_attenddata "https://github.com/rudra512004/hrms/blob/main/backend/apps/attendance/models.py"
click node_attendancecalc "https://github.com/rudra512004/hrms/blob/main/backend/apps/attendance/services.py"
click node_orgdata "https://github.com/rudra512004/hrms/blob/main/backend/apps/organization/models.py"
click node_calendar "https://github.com/rudra512004/hrms/blob/main/backend/apps/organization/services.py"
click node_dashboardpage "https://github.com/rudra512004/hrms/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_dashboard "https://github.com/rudra512004/hrms/blob/main/backend/apps/dashboard/services.py"
click node_payrollpage "https://github.com/rudra512004/hrms/blob/main/frontend/src/pages/PayrollPage.tsx"
click node_payrollclient "https://github.com/rudra512004/hrms/blob/main/frontend/src/services/payroll.ts"
click node_payrollsvc "https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/services.py"
click node_payrolldata "https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/models.py"
click node_reports "https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/services_reporting.py"
click node_notify "https://github.com/rudra512004/hrms/blob/main/backend/apps/notifications/services.py"
click node_audit "https://github.com/rudra512004/hrms/blob/main/backend/apps/audit/services.py"

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_app,node_router,node_user toneBlue
class node_authctx,node_authsvc,node_branchctx,node_orgclient,node_access,node_accessdata toneAmber
class node_workpages,node_adminpages,node_employeedata,node_leavedata,node_attenddata,node_attendancecalc,node_orgdata toneMint
class node_dashboardpage,node_dashboard,node_payrollpage,node_payrollclient,node_payrollsvc,node_payrolldata,node_reports toneRose
class node_calendar,node_notify,node_audit toneIndigo
```

## Components

### Web application

- [Application shell](https://github.com/rudra512004/hrms/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Protected routing](https://github.com/rudra512004/hrms/blob/main/frontend/src/routes/AppRouter.tsx): `frontend/src/routes/AppRouter.tsx`

### Identity and access

- [Session context](https://github.com/rudra512004/hrms/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [Authentication client](https://github.com/rudra512004/hrms/blob/main/frontend/src/services/auth.ts): `frontend/src/services/auth.ts`
- [Branch context](https://github.com/rudra512004/hrms/blob/main/frontend/src/contexts/BranchContext.tsx): `frontend/src/contexts/BranchContext.tsx`
- [Organization client](https://github.com/rudra512004/hrms/blob/main/frontend/src/services/organization.ts): `frontend/src/services/organization.ts`
- [RBAC services](https://github.com/rudra512004/hrms/blob/main/backend/apps/authorization/services.py): `backend/apps/authorization/services.py`
- [Roles and grants](https://github.com/rudra512004/hrms/blob/main/backend/apps/authorization/models.py): `backend/apps/authorization/models.py`

### Workforce operations

- [Attendance and leave](https://github.com/rudra512004/hrms/tree/main/frontend/src/pages): `frontend/src/pages`
- [HR administration](https://github.com/rudra512004/hrms/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Employee records](https://github.com/rudra512004/hrms/blob/main/backend/apps/employees/models.py): `backend/apps/employees/models.py`
- [Leave records](https://github.com/rudra512004/hrms/blob/main/backend/apps/leaves/models.py): `backend/apps/leaves/models.py`
- [Attendance records](https://github.com/rudra512004/hrms/blob/main/backend/apps/attendance/models.py): `backend/apps/attendance/models.py`
- [Attendance calculations](https://github.com/rudra512004/hrms/blob/main/backend/apps/attendance/services.py): `backend/apps/attendance/services.py`
- [Organization structure](https://github.com/rudra512004/hrms/blob/main/backend/apps/organization/models.py): `backend/apps/organization/models.py`

### Dashboards and payroll

- [Dashboard page](https://github.com/rudra512004/hrms/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Dashboard aggregation](https://github.com/rudra512004/hrms/blob/main/backend/apps/dashboard/services.py): `backend/apps/dashboard/services.py`
- [Payroll management](https://github.com/rudra512004/hrms/blob/main/frontend/src/pages/PayrollPage.tsx): `frontend/src/pages/PayrollPage.tsx`
- [Payroll client](https://github.com/rudra512004/hrms/blob/main/frontend/src/services/payroll.ts): `frontend/src/services/payroll.ts`
- [Payroll processing](https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/services.py): `backend/apps/payroll/services.py`
- [Payroll records](https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/models.py): `backend/apps/payroll/models.py`
- [Payroll reporting](https://github.com/rudra512004/hrms/blob/main/backend/apps/payroll/services_reporting.py): `backend/apps/payroll/services_reporting.py`

### Shared backend services

- [Working calendar](https://github.com/rudra512004/hrms/blob/main/backend/apps/organization/services.py): `backend/apps/organization/services.py`
- [Notifications](https://github.com/rudra512004/hrms/blob/main/backend/apps/notifications/services.py): `backend/apps/notifications/services.py`
- [Audit logging](https://github.com/rudra512004/hrms/blob/main/backend/apps/audit/services.py): `backend/apps/audit/services.py`

### Other components

- **HRMS user**

## Connections

- HRMS user → Application shell: uses
- Application shell → Protected routing: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Session context: provides session (evidence: `frontend/src/App.tsx`)
- Application shell → Branch context: provides branch (evidence: `frontend/src/App.tsx`)
- Session context → Authentication client: loads session (evidence: `frontend/src/contexts/AuthContext.tsx`)
- Branch context → Session context: reads user (evidence: `frontend/src/contexts/BranchContext.tsx`)
- Branch context → Organization client: lists branches (evidence: `frontend/src/contexts/BranchContext.tsx`)
- RBAC services → Roles and grants: queries grants (evidence: `backend/apps/authorization/services.py`)
- RBAC services → Organization structure: resolves branch (evidence: `backend/apps/authorization/services.py`)
- Protected routing → Dashboard page: routes to (evidence: `frontend/src/routes/AppRouter.tsx`)
- Protected routing → Attendance and leave: routes to (evidence: `frontend/src/routes/AppRouter.tsx`)
- Protected routing → HR administration: routes to (evidence: `frontend/src/routes/AppRouter.tsx`)
- Protected routing → Payroll management: routes to (evidence: `frontend/src/routes/AppRouter.tsx`)
- Protected routing → Session context: guards routes
- Attendance calculations → Attendance records: queries (evidence: `backend/apps/attendance/services.py`)
- Attendance calculations → Employee records: uses employee (evidence: `backend/apps/attendance/services.py`)
- Attendance calculations → Organization structure: resolves branch (evidence: `backend/apps/attendance/services.py`)
- Attendance calculations → Working calendar: checks workdays (evidence: `backend/apps/attendance/services.py`)
- Attendance calculations → Leave records: references leave (evidence: `backend/apps/attendance/services.py`)
- Working calendar → Organization structure: reads calendar (evidence: `backend/apps/organization/services.py`)
- Dashboard aggregation → RBAC services: uses permissions (evidence: `backend/apps/dashboard/services.py`)
- Dashboard aggregation → Attendance records: queries attendance (evidence: `backend/apps/dashboard/services.py`)
- Dashboard aggregation → Leave records: queries leave (evidence: `backend/apps/dashboard/services.py`)
- Dashboard aggregation → Employee records: queries employees (evidence: `backend/apps/dashboard/services.py`)
- Payroll management → Payroll client: uses payroll API (evidence: `frontend/src/pages/PayrollPage.tsx`)
- Payroll processing → Attendance records: reads attendance (evidence: `backend/apps/payroll/services.py`)
- Payroll processing → Leave records: reads leave (evidence: `backend/apps/payroll/services.py`)
- Payroll processing → Payroll records: processes payroll (evidence: `backend/apps/payroll/services.py`)
- Payroll processing → Organization structure: uses organization (evidence: `backend/apps/payroll/services.py`)
- Payroll processing → Employee records: reads employees (evidence: `backend/apps/payroll/services.py`)
- Payroll processing → Notifications: sends notices (evidence: `backend/apps/payroll/services.py`)
- Payroll reporting → Payroll records: reads payroll (evidence: `backend/apps/payroll/services_reporting.py`)
- Payroll reporting → Attendance records: reads attendance (evidence: `backend/apps/payroll/services_reporting.py`)
- Payroll reporting → Leave records: reads leave (evidence: `backend/apps/payroll/services_reporting.py`)
- Audit logging → Notifications: optional integration
