# wesley-2329/hrm_project architecture

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

- Interactive diagram: https://gitdiagram.com/wesley-2329/hrm_project
- Repository: https://github.com/wesley-2329/hrm_project

## Overview

HRorbit is a role-based HR management portal: employees and HR staff sign in, enter role-specific workspaces, and use HR, organization, and employee-service modules. The React client sends API requests to an Express server, which applies authentication and routes domain operations to MongoDB-backed models. The README documents recruitment, learning, leave, shift logging, and helpdesk capabilities; the tree also shows budgeting, compliance, engagement, performance, and exit modules. Some domain routes and UI modules were not sampled, so those branches reflect documented capabilities and paths, not inspected call details.

Main entry points: [`frontend/src/api.js`](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/api.js) (HTTP client), [`frontend/src/App.jsx`](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/App.jsx) (Application shell), [`backend/server.js`](https://github.com/wesley-2329/hrm_project/blob/main/backend/server.js) (Express API server), [`backend/models/Employee.js`](https://github.com/wesley-2329/hrm_project/blob/main/backend/models/Employee.js) (Employee records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_spa["Application shell<br/>[App.jsx]"]
  node_login["Login gateway<br/>[LoginGateway.jsx]"]
  node_authctx["Session state<br/>[AuthContext.jsx]"]
  node_datacontext["Shared HR data<br/>[DataContext.jsx]"]
  node_employeeui["Employee workspace<br/>[EmployeeApp.jsx]"]
  node_hrui["HR workspace<br/>[HRApp.jsx]"]
  node_api_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_server["Express API server<br/>[server.js]"]
  node_authroute["Authentication routes<br/>[auth.js]"]
  node_authmw["Token protection<br/>[auth.js]"]
  node_employee_model[("Employee records<br/>[Employee.js]")]
  node_database[("MongoDB<br/>[db.js]")]
end

subgraph group_people["People operations"]
  node_taskroute["Task routes<br/>[tasks.js]"]
  node_recruitui["Recruitment ATS"]
  node_recruitroute["Recruitment routes<br/>[recruitment.js]"]
  node_performanceui["Performance reviews"]
  node_performanceroute["Performance routes<br/>[performance.js]"]
  node_learning["Learning academy<br/>[TrainingModule.jsx]"]
  node_exit["Employee exit<br/>[ExitModule.jsx]"]
  node_helpdesk["Support helpdesk<br/>[tickets.js]"]
end

subgraph group_enterprise["Enterprise HR"]
  node_orgroute["Organization routes<br/>[org.js]"]
  node_budget["Budgeting"]
  node_compliance["Statutory compliance"]
  node_engagement["Engagement"]
end

node_user(("HR or employee"))

node_user -->|"opens portal"| node_spa
node_spa -->|"routes login"| node_login
node_spa -->|"provides session"| node_authctx
node_spa -->|"provides data"| node_datacontext
node_spa -->|"renders workspace"| node_employeeui
node_spa -->|"renders workspace"| node_hrui
node_login -.->|"authenticates"| node_authctx
node_authctx -->|"requests profile"| node_api_client
node_datacontext -->|"fetches HR data"| node_api_client
node_api_client -->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_authroute
node_server -->|"mounts routes"| node_orgroute
node_server -->|"mounts routes"| node_taskroute
node_server -->|"connects database"| node_database
node_authroute -->|"protects profile"| node_authmw
node_authroute -->|"reads and writes"| node_employee_model
node_authmw -->|"loads user"| node_employee_model
node_authmw -->|"ensures connection"| node_database
node_taskroute -->|"protects requests"| node_authmw
node_orgroute -->|"updates employees"| node_employee_model
node_employeeui -->|"renders module"| node_recruitui
node_employeeui -.->|"renders module"| node_performanceui
node_hrui -.->|"offers budgeting"| node_budget
node_hrui -.->|"offers compliance"| node_compliance
node_hrui -.->|"offers engagement"| node_engagement
node_recruitui -->|"uses API"| node_api_client
node_performanceui -->|"uses API"| node_api_client
node_recruitroute -.->|"uses employee data"| node_employee_model
node_performanceroute -->|"uses employee data"| node_employee_model
node_learning -.->|"uses API"| node_api_client
node_exit -.->|"uses API"| node_api_client
node_budget -->|"uses API"| node_api_client
node_compliance -->|"uses API"| node_api_client
node_engagement -->|"uses API"| node_api_client
node_user -.->|"uses helpdesk"| node_helpdesk

click node_spa "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/LoginGateway.jsx"
click node_authctx "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/context/AuthContext.jsx"
click node_datacontext "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/context/DataContext.jsx"
click node_employeeui "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/EmployeeApp.jsx"
click node_hrui "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/HRApp.jsx"
click node_api_client "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/api.js"
click node_server "https://github.com/wesley-2329/hrm_project/blob/main/backend/server.js"
click node_authroute "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/wesley-2329/hrm_project/blob/main/backend/middleware/auth.js"
click node_employee_model "https://github.com/wesley-2329/hrm_project/blob/main/backend/models/Employee.js"
click node_database "https://github.com/wesley-2329/hrm_project/blob/main/backend/config/db.js"
click node_orgroute "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/org.js"
click node_taskroute "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/tasks.js"
click node_recruitui "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/recruitment/RecruitmentModule.jsx"
click node_recruitroute "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/recruitment.js"
click node_performanceui "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/performance/PerformanceModule.jsx"
click node_performanceroute "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/performance.js"
click node_learning "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/learning/TrainingModule.jsx"
click node_exit "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/exit/ExitModule.jsx"
click node_budget "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/budgeting/BudgetingModule.jsx"
click node_compliance "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/compliance/StatutoryComplianceModule.jsx"
click node_engagement "https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/engagement/EngagementModule.jsx"
click node_helpdesk "https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/tickets.js"

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_spa,node_login,node_authctx,node_datacontext,node_employeeui,node_hrui,node_api_client toneBlue
class node_server,node_authroute,node_authmw,node_employee_model,node_database toneAmber
class node_taskroute,node_recruitui,node_recruitroute,node_performanceui,node_performanceroute,node_learning,node_exit,node_helpdesk toneMint
class node_orgroute,node_budget,node_compliance,node_engagement toneRose
class node_user toneIndigo
```

## Components

### React client

- [Application shell](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login gateway](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/LoginGateway.jsx): `frontend/src/pages/LoginGateway.jsx`
- [Session state](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Shared HR data](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/context/DataContext.jsx): `frontend/src/context/DataContext.jsx`
- [Employee workspace](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/EmployeeApp.jsx): `frontend/src/pages/EmployeeApp.jsx`
- [HR workspace](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/HRApp.jsx): `frontend/src/pages/HRApp.jsx`
- [HTTP client](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API and access

- [Express API server](https://github.com/wesley-2329/hrm_project/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Token protection](https://github.com/wesley-2329/hrm_project/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Employee records](https://github.com/wesley-2329/hrm_project/blob/main/backend/models/Employee.js): `backend/models/Employee.js`
- [MongoDB](https://github.com/wesley-2329/hrm_project/blob/main/backend/config/db.js): `backend/config/db.js`

### People operations

- [Task routes](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/tasks.js): `backend/routes/tasks.js`
- [Recruitment ATS](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/recruitment/RecruitmentModule.jsx): `frontend/src/pages/recruitment/RecruitmentModule.jsx`
- [Recruitment routes](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/recruitment.js): `backend/routes/recruitment.js`
- [Performance reviews](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/performance/PerformanceModule.jsx): `frontend/src/pages/performance/PerformanceModule.jsx`
- [Performance routes](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/performance.js): `backend/routes/performance.js`
- [Learning academy](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/learning/TrainingModule.jsx): `frontend/src/pages/learning/TrainingModule.jsx`
- [Employee exit](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/exit/ExitModule.jsx): `frontend/src/pages/exit/ExitModule.jsx`
- [Support helpdesk](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/tickets.js): `backend/routes/tickets.js`

### Enterprise HR

- [Organization routes](https://github.com/wesley-2329/hrm_project/blob/main/backend/routes/org.js): `backend/routes/org.js`
- [Budgeting](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/budgeting/BudgetingModule.jsx): `frontend/src/pages/budgeting/BudgetingModule.jsx`
- [Statutory compliance](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/compliance/StatutoryComplianceModule.jsx): `frontend/src/pages/compliance/StatutoryComplianceModule.jsx`
- [Engagement](https://github.com/wesley-2329/hrm_project/blob/main/frontend/src/pages/engagement/EngagementModule.jsx): `frontend/src/pages/engagement/EngagementModule.jsx`

### Other components

- **HR or employee**

## Connections

- HR or employee → Application shell: opens portal (evidence: `README.md`)
- Application shell → Login gateway: routes login (evidence: `frontend/src/App.jsx`)
- Application shell → Session state: provides session (evidence: `frontend/src/App.jsx`)
- Application shell → Shared HR data: provides data (evidence: `frontend/src/App.jsx`)
- Application shell → Employee workspace: renders workspace (evidence: `frontend/src/App.jsx`)
- Application shell → HR workspace: renders workspace (evidence: `frontend/src/App.jsx`)
- Login gateway → Session state: authenticates
- Session state → HTTP client: requests profile (evidence: `frontend/src/context/AuthContext.jsx`)
- Shared HR data → HTTP client: fetches HR data (evidence: `frontend/src/context/DataContext.jsx`)
- HTTP client → Express API server: sends API requests (evidence: `README.md`)
- Express API server → Authentication routes: mounts routes (evidence: `backend/server.js`)
- Express API server → Organization routes: mounts routes (evidence: `backend/server.js`)
- Express API server → Task routes: mounts routes (evidence: `backend/server.js`)
- Express API server → MongoDB: connects database (evidence: `backend/server.js`)
- Authentication routes → Token protection: protects profile (evidence: `backend/routes/auth.js`)
- Authentication routes → Employee records: reads and writes (evidence: `backend/routes/auth.js`)
- Token protection → Employee records: loads user (evidence: `backend/middleware/auth.js`)
- Token protection → MongoDB: ensures connection (evidence: `backend/middleware/auth.js`)
- Task routes → Token protection: protects requests (evidence: `backend/routes/tasks.js`)
- Organization routes → Employee records: updates employees (evidence: `backend/routes/org.js`)
- Employee workspace → Recruitment ATS: renders module (evidence: `frontend/src/pages/EmployeeApp.jsx`)
- Employee workspace → Performance reviews: renders module (evidence: `frontend/src/pages/EmployeeApp.jsx`)
- HR workspace → Budgeting: offers budgeting
- HR workspace → Statutory compliance: offers compliance
- HR workspace → Engagement: offers engagement
- Recruitment ATS → HTTP client: uses API (evidence: `frontend/src/pages/recruitment/RecruitmentModule.jsx`)
- Performance reviews → HTTP client: uses API (evidence: `frontend/src/pages/performance/PerformanceModule.jsx`)
- Recruitment routes → Employee records: uses employee data
- Performance routes → Employee records: uses employee data (evidence: `backend/routes/performance.js`)
- Learning academy → HTTP client: uses API
- Employee exit → HTTP client: uses API
- Budgeting → HTTP client: uses API (evidence: `frontend/src/pages/budgeting/BudgetingModule.jsx`)
- Statutory compliance → HTTP client: uses API (evidence: `frontend/src/pages/compliance/StatutoryComplianceModule.jsx`)
- Engagement → HTTP client: uses API (evidence: `frontend/src/pages/engagement/EngagementModule.jsx`)
- HR or employee → Support helpdesk: uses helpdesk
