# repplen/labour_module architecture

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

- Interactive diagram: https://gitdiagram.com/repplen/labour_module
- Repository: https://github.com/repplen/labour_module

## Overview

Employee App is a full-stack employee-operations system: users work through a React interface, which reaches an Express API backed by MongoDB. The documented capabilities span employee and master-data administration, attendance, checklists, complaints, polls, chat, permissions, and reports. The excerpts show the application’s route registration, checklist handling, authentication, and personal-task UI calls; many other feature branches are documented but their implementation wiring was not sampled, so those links are marked unverified.

Main entry points: [`backend/controllers/dashboard.controller.js`](https://github.com/repplen/labour_module/blob/main/backend/controllers/dashboard.controller.js) (Dashboards and reports), [`backend/app.js`](https://github.com/repplen/labour_module/blob/main/backend/app.js) (Express API), [`backend/controllers/checklist.controller.js`](https://github.com/repplen/labour_module/blob/main/backend/controllers/checklist.controller.js) (Checklist handlers), [`backend/routes/checklist.routes.js`](https://github.com/repplen/labour_module/blob/main/backend/routes/checklist.routes.js) (Checklist routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_webapp["React application<br/>[App.jsx]"]
  node_task_ui["Personal task UI<br/>[useOwnTasks.js]"]
  node_task_api_client["Task API client"]
end

subgraph group_api["API and access"]
  node_express["Express API<br/>[app.js]"]
  node_auth["JWT authentication<br/>[auth.js]"]
  node_permissions["Permission checks<br/>[permissions.js]"]
  node_validation["Request validation<br/>[validateRequest.js]"]
  node_env["Environment config<br/>[env.js]"]
  node_employee_routes["Employee routes<br/>[employee.routes.js]"]
  node_checklist_routes["Checklist routes"]
end

subgraph group_operations["Operations workflows"]
  node_checklist_controller["Checklist handlers"]
  node_checklist_workflow["Checklist workflow"]
  node_complaints["Complaint management"]
  node_polls["Poll management<br/>[poll.controller.js]"]
  node_dashboard["Dashboards and reports"]
  node_tasks["Personal task service"]
end

subgraph group_records["MongoDB records"]
  node_employee_record[("Employee records<br/>[Employee.js]")]
  node_user_record[("User records<br/>[User.js]")]
  node_checklist_record[("Checklist records<br/>[Checklist.js]")]
  node_checklist_task_record[("Checklist task records<br/>[ChecklistTask.js]")]
  node_personal_task_record[("Personal task records<br/>[PersonalTask.js]")]
  node_site_record[("Site records<br/>[Site.js]")]
  node_department_record[("Department records<br/>[Department.js]")]
  node_company_record[("Company records<br/>[Company.js]")]
end

node_employee(("Employee user"))

node_employee -->|"uses"| node_webapp
node_webapp -.->|"calls API"| node_express
node_webapp -->|"routes to"| node_task_ui
node_task_ui -->|"calls"| node_task_api_client
node_express -->|"loads config"| node_env
node_express -->|"mounts"| node_employee_routes
node_express -->|"mounts"| node_checklist_routes
node_employee_routes -->|"applies"| node_auth
node_checklist_routes -->|"applies"| node_auth
node_checklist_routes -->|"applies"| node_permissions
node_checklist_routes -->|"applies"| node_validation
node_checklist_routes -->|"dispatches"| node_checklist_controller
node_auth -->|"reads secrets"| node_env
node_auth -->|"loads principal"| node_employee_record
node_auth -->|"loads principal"| node_user_record
node_checklist_controller -->|"reads and writes"| node_checklist_record
node_checklist_controller -->|"reads and writes"| node_checklist_task_record
node_checklist_controller -->|"uses workflow"| node_checklist_workflow
node_checklist_workflow -->|"reads and writes"| node_checklist_record
node_checklist_workflow -->|"creates tasks"| node_checklist_task_record
node_checklist_controller -->|"queries employees"| node_employee_record
node_checklist_controller -->|"queries sites"| node_site_record
node_dashboard -->|"queries"| node_checklist_record
node_dashboard -->|"queries"| node_checklist_task_record
node_dashboard -->|"queries"| node_employee_record
node_dashboard -->|"queries"| node_personal_task_record
node_dashboard -->|"queries"| node_site_record
node_dashboard -->|"queries"| node_department_record
node_dashboard -->|"queries"| node_company_record
node_task_api_client -.->|"requests tasks"| node_tasks
node_tasks -->|"reads and writes"| node_personal_task_record
node_express -.->|"exposes feature"| node_complaints
node_express -.->|"exposes feature"| node_polls
node_express -.->|"exposes feature"| node_dashboard

click node_webapp "https://github.com/repplen/labour_module/blob/main/frontend/src/App.jsx"
click node_task_ui "https://github.com/repplen/labour_module/blob/main/frontend/src/hooks/personalTasks/useOwnTasks.js"
click node_task_api_client "https://github.com/repplen/labour_module/blob/main/frontend/src/services/personalTask.service.js"
click node_express "https://github.com/repplen/labour_module/blob/main/backend/app.js"
click node_auth "https://github.com/repplen/labour_module/blob/main/backend/middleware/auth.js"
click node_permissions "https://github.com/repplen/labour_module/blob/main/backend/middleware/permissions.js"
click node_validation "https://github.com/repplen/labour_module/blob/main/backend/middleware/validateRequest.js"
click node_env "https://github.com/repplen/labour_module/blob/main/backend/config/env.js"
click node_employee_routes "https://github.com/repplen/labour_module/blob/main/backend/routes/employee.routes.js"
click node_checklist_routes "https://github.com/repplen/labour_module/blob/main/backend/routes/checklist.routes.js"
click node_checklist_controller "https://github.com/repplen/labour_module/blob/main/backend/controllers/checklist.controller.js"
click node_checklist_workflow "https://github.com/repplen/labour_module/blob/main/backend/services/checklistWorkflow.service.js"
click node_complaints "https://github.com/repplen/labour_module/blob/main/backend/controllers/complaint.controller.js"
click node_polls "https://github.com/repplen/labour_module/blob/main/backend/controllers/poll.controller.js"
click node_dashboard "https://github.com/repplen/labour_module/blob/main/backend/controllers/dashboard.controller.js"
click node_tasks "https://github.com/repplen/labour_module/blob/main/backend/services/personalTask.service.js"
click node_employee_record "https://github.com/repplen/labour_module/blob/main/backend/models/Employee.js"
click node_user_record "https://github.com/repplen/labour_module/blob/main/backend/models/User.js"
click node_checklist_record "https://github.com/repplen/labour_module/blob/main/backend/models/Checklist.js"
click node_checklist_task_record "https://github.com/repplen/labour_module/blob/main/backend/models/ChecklistTask.js"
click node_personal_task_record "https://github.com/repplen/labour_module/blob/main/backend/models/PersonalTask.js"
click node_site_record "https://github.com/repplen/labour_module/blob/main/backend/models/Site.js"
click node_department_record "https://github.com/repplen/labour_module/blob/main/backend/models/Department.js"
click node_company_record "https://github.com/repplen/labour_module/blob/main/backend/models/Company.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_webapp,node_task_ui,node_task_api_client,node_employee toneBlue
class node_express,node_auth,node_permissions,node_validation,node_env,node_employee_routes,node_checklist_routes toneAmber
class node_checklist_controller,node_checklist_workflow,node_complaints,node_polls,node_dashboard,node_tasks toneMint
class node_employee_record,node_user_record,node_checklist_record,node_checklist_task_record,node_personal_task_record,node_site_record,node_department_record,node_company_record toneRose
```

## Components

### User interface

- [React application](https://github.com/repplen/labour_module/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Personal task UI](https://github.com/repplen/labour_module/blob/main/frontend/src/hooks/personalTasks/useOwnTasks.js): `frontend/src/hooks/personalTasks/useOwnTasks.js`
- [Task API client](https://github.com/repplen/labour_module/blob/main/frontend/src/services/personalTask.service.js): `frontend/src/services/personalTask.service.js`

### API and access

- [Express API](https://github.com/repplen/labour_module/blob/main/backend/app.js): `backend/app.js`
- [JWT authentication](https://github.com/repplen/labour_module/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Permission checks](https://github.com/repplen/labour_module/blob/main/backend/middleware/permissions.js): `backend/middleware/permissions.js`
- [Request validation](https://github.com/repplen/labour_module/blob/main/backend/middleware/validateRequest.js): `backend/middleware/validateRequest.js`
- [Environment config](https://github.com/repplen/labour_module/blob/main/backend/config/env.js): `backend/config/env.js`
- [Employee routes](https://github.com/repplen/labour_module/blob/main/backend/routes/employee.routes.js): `backend/routes/employee.routes.js`
- [Checklist routes](https://github.com/repplen/labour_module/blob/main/backend/routes/checklist.routes.js): `backend/routes/checklist.routes.js`

### Operations workflows

- [Checklist handlers](https://github.com/repplen/labour_module/blob/main/backend/controllers/checklist.controller.js): `backend/controllers/checklist.controller.js`
- [Checklist workflow](https://github.com/repplen/labour_module/blob/main/backend/services/checklistWorkflow.service.js): `backend/services/checklistWorkflow.service.js`
- [Complaint management](https://github.com/repplen/labour_module/blob/main/backend/controllers/complaint.controller.js): `backend/controllers/complaint.controller.js`
- [Poll management](https://github.com/repplen/labour_module/blob/main/backend/controllers/poll.controller.js): `backend/controllers/poll.controller.js`
- [Dashboards and reports](https://github.com/repplen/labour_module/blob/main/backend/controllers/dashboard.controller.js): `backend/controllers/dashboard.controller.js`
- [Personal task service](https://github.com/repplen/labour_module/blob/main/backend/services/personalTask.service.js): `backend/services/personalTask.service.js`

### MongoDB records

- [Employee records](https://github.com/repplen/labour_module/blob/main/backend/models/Employee.js): `backend/models/Employee.js`
- [User records](https://github.com/repplen/labour_module/blob/main/backend/models/User.js): `backend/models/User.js`
- [Checklist records](https://github.com/repplen/labour_module/blob/main/backend/models/Checklist.js): `backend/models/Checklist.js`
- [Checklist task records](https://github.com/repplen/labour_module/blob/main/backend/models/ChecklistTask.js): `backend/models/ChecklistTask.js`
- [Personal task records](https://github.com/repplen/labour_module/blob/main/backend/models/PersonalTask.js): `backend/models/PersonalTask.js`
- [Site records](https://github.com/repplen/labour_module/blob/main/backend/models/Site.js): `backend/models/Site.js`
- [Department records](https://github.com/repplen/labour_module/blob/main/backend/models/Department.js): `backend/models/Department.js`
- [Company records](https://github.com/repplen/labour_module/blob/main/backend/models/Company.js): `backend/models/Company.js`

### Other components

- **Employee user**

## Connections

- Employee user → React application: uses (evidence: `README.md`)
- React application → Express API: calls API
- React application → Personal task UI: routes to (evidence: `frontend/src/App.jsx`)
- Personal task UI → Task API client: calls (evidence: `frontend/src/hooks/personalTasks/useOwnTasks.js`)
- Express API → Environment config: loads config (evidence: `backend/app.js`)
- Express API → Employee routes: mounts (evidence: `backend/app.js`)
- Express API → Checklist routes: mounts (evidence: `backend/app.js`)
- Employee routes → JWT authentication: applies (evidence: `backend/routes/employee.routes.js`)
- Checklist routes → JWT authentication: applies (evidence: `backend/routes/checklist.routes.js`)
- Checklist routes → Permission checks: applies (evidence: `backend/routes/checklist.routes.js`)
- Checklist routes → Request validation: applies (evidence: `backend/routes/checklist.routes.js`)
- Checklist routes → Checklist handlers: dispatches (evidence: `backend/routes/checklist.routes.js`)
- JWT authentication → Environment config: reads secrets (evidence: `backend/middleware/auth.js`)
- JWT authentication → Employee records: loads principal (evidence: `backend/middleware/auth.js`)
- JWT authentication → User records: loads principal (evidence: `backend/middleware/auth.js`)
- Checklist handlers → Checklist records: reads and writes (evidence: `backend/controllers/checklist.controller.js`)
- Checklist handlers → Checklist task records: reads and writes (evidence: `backend/controllers/checklist.controller.js`)
- Checklist handlers → Checklist workflow: uses workflow (evidence: `backend/controllers/checklist.controller.js`)
- Checklist workflow → Checklist records: reads and writes (evidence: `backend/services/checklistWorkflow.service.js`)
- Checklist workflow → Checklist task records: creates tasks (evidence: `backend/services/checklistWorkflow.service.js`)
- Checklist handlers → Employee records: queries employees (evidence: `backend/controllers/checklist.controller.js`)
- Checklist handlers → Site records: queries sites (evidence: `backend/controllers/checklist.controller.js`)
- Dashboards and reports → Checklist records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Checklist task records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Employee records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Personal task records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Site records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Department records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Dashboards and reports → Company records: queries (evidence: `backend/controllers/dashboard.controller.js`)
- Task API client → Personal task service: requests tasks
- Personal task service → Personal task records: reads and writes (evidence: `backend/services/personalTask.service.js`)
- Express API → Complaint management: exposes feature
- Express API → Poll management: exposes feature
- Express API → Dashboards and reports: exposes feature
