# navaneeth4141/workforce360 architecture

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

- Interactive diagram: https://gitdiagram.com/navaneeth4141/workforce360
- Repository: https://github.com/navaneeth4141/workforce360

## Overview

WorkForce360 is a staffing-agency platform whose main workflow is role-based admin or worker access to workforce records and operational features, with backend APIs persisting business data and producing payroll, invoices, and reports. The graph preserves documented capabilities even where their implementation was not sampled; those less-visible subsystem links are omitted rather than inferred. Source excerpts and the index support the shown API, controller, calculation, and persistence relationships; the README documents the broader system boundary.

Main entry points: [`backend/src/routes/api.js`](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/routes/api.js) (REST API routes), [`backend/src/lib/prisma.js`](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/lib/prisma.js) (Prisma client), [`backend/src/controllers/payrollController.js`](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/payrollController.js) (Payroll and payslips), [`backend/src/controllers/invoiceController.js`](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/invoiceController.js) (Invoice generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User portals"]
  node_admin["Admin portal<br/>[AdminLayout.js]"]
  node_worker["Worker portal<br/>[WorkerLayout.js]"]
  node_auth["Session and login<br/>[AuthContext.js]"]
end

subgraph group_workforce["Workforce operations"]
  node_employees["Employee management<br/>[page.js]"]
  node_attendance["Attendance tracking<br/>[page.js]"]
  node_selfservice["Worker self-service<br/>[page.js]"]
  node_clients["Clients and contracts"]
end

subgraph group_finance["Finance and reporting"]
  node_payroll["Payroll and payslips"]
  node_paycalc["Payroll calculation<br/>[payrollService.js]"]
  node_invoice["Invoice generation"]
  node_invoicecalc["Invoice calculation<br/>[invoiceService.js]"]
  node_reports["Reports and exports"]
  node_expenses["Expense management"]
  node_pdf["PDF generation<br/>[pdfService.js]"]
  node_excel["Excel exports<br/>[excelService.js]"]
end

subgraph group_platform["API and persistence"]
  node_api["REST API routes<br/>[api.js]"]
  node_server["Express server<br/>[app.js]"]
  node_authmw["Route authorization<br/>[auth.js]"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_database[("PostgreSQL")]
end

node_staff(("Staffing team"))
node_workers(("Workers"))

node_staff -.->|"uses"| node_admin
node_workers -.->|"uses"| node_worker
node_admin -->|"checks session"| node_auth
node_worker -->|"checks session"| node_auth
node_auth -->|"requests login"| node_api
node_admin -.->|"renders"| node_employees
node_employees -->|"requests data"| node_api
node_attendance -->|"requests data"| node_api
node_selfservice -->|"requests data"| node_api
node_server -->|"mounts routes"| node_api
node_api -->|"applies guards"| node_authmw
node_api -->|"dispatches"| node_employees
node_api -->|"dispatches"| node_attendance
node_api -->|"dispatches"| node_payroll
node_api -->|"dispatches"| node_clients
node_api -->|"dispatches"| node_invoice
node_api -->|"dispatches"| node_expenses
node_api -->|"dispatches"| node_reports
node_employees -->|"reads and writes"| node_prisma
node_clients -->|"reads and writes"| node_prisma
node_payroll -->|"reads and writes"| node_prisma
node_payroll -->|"calculates payroll"| node_paycalc
node_payroll -->|"generates payslips"| node_pdf
node_invoice -->|"reads and writes"| node_prisma
node_invoice -->|"calculates invoice"| node_invoicecalc
node_invoice -->|"generates invoice PDF"| node_pdf
node_reports -->|"reads reports"| node_prisma
node_reports -->|"exports workbook"| node_excel
node_prisma -.->|"accesses"| node_database

click node_admin "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/components/AdminLayout.js"
click node_worker "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/components/WorkerLayout.js"
click node_auth "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/context/AuthContext.js"
click node_employees "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/employees/page.js"
click node_attendance "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/attendance/page.js"
click node_selfservice "https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/worker/page.js"
click node_clients "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/clientController.js"
click node_payroll "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/payrollController.js"
click node_paycalc "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/payrollService.js"
click node_invoice "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/invoiceController.js"
click node_invoicecalc "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/invoiceService.js"
click node_reports "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/reportsController.js"
click node_expenses "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/expenseController.js"
click node_api "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/routes/api.js"
click node_server "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/app.js"
click node_authmw "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/middleware/auth.js"
click node_prisma "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/lib/prisma.js"
click node_pdf "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/pdfService.js"
click node_excel "https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/excelService.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_admin,node_worker,node_auth toneBlue
class node_employees,node_attendance,node_selfservice,node_clients toneAmber
class node_payroll,node_paycalc,node_invoice,node_invoicecalc,node_reports,node_expenses,node_pdf,node_excel toneMint
class node_api,node_server,node_authmw,node_prisma,node_database,node_workers toneRose
class node_staff toneIndigo
```

## Components

### User portals

- [Admin portal](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/components/AdminLayout.js): `frontend/src/components/AdminLayout.js`
- [Worker portal](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/components/WorkerLayout.js): `frontend/src/components/WorkerLayout.js`
- [Session and login](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/context/AuthContext.js): `frontend/src/context/AuthContext.js`

### Workforce operations

- [Employee management](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/employees/page.js): `frontend/src/app/employees/page.js`
- [Attendance tracking](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/attendance/page.js): `frontend/src/app/attendance/page.js`
- [Worker self-service](https://github.com/navaneeth4141/workforce360/blob/main/frontend/src/app/worker/page.js): `frontend/src/app/worker/page.js`
- [Clients and contracts](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/clientController.js): `backend/src/controllers/clientController.js`

### Finance and reporting

- [Payroll and payslips](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/payrollController.js): `backend/src/controllers/payrollController.js`
- [Payroll calculation](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/payrollService.js): `backend/src/services/payrollService.js`
- [Invoice generation](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/invoiceController.js): `backend/src/controllers/invoiceController.js`
- [Invoice calculation](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/invoiceService.js): `backend/src/services/invoiceService.js`
- [Reports and exports](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/reportsController.js): `backend/src/controllers/reportsController.js`
- [Expense management](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/controllers/expenseController.js): `backend/src/controllers/expenseController.js`
- [PDF generation](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/pdfService.js): `backend/src/services/pdfService.js`
- [Excel exports](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/services/excelService.js): `backend/src/services/excelService.js`

### API and persistence

- [REST API routes](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/routes/api.js): `backend/src/routes/api.js`
- [Express server](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/app.js): `backend/src/app.js`
- [Route authorization](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/middleware/auth.js): `backend/src/middleware/auth.js`
- [Prisma client](https://github.com/navaneeth4141/workforce360/blob/main/backend/src/lib/prisma.js): `backend/src/lib/prisma.js`
- **PostgreSQL**

### Other components

- **Staffing team**
- **Workers**

## Connections

- Staffing team → Admin portal: uses (evidence: `README.md`)
- Workers → Worker portal: uses (evidence: `README.md`)
- Admin portal → Session and login: checks session (evidence: `frontend/src/components/AdminLayout.js`)
- Worker portal → Session and login: checks session (evidence: `frontend/src/components/WorkerLayout.js`)
- Session and login → REST API routes: requests login (evidence: `frontend/src/context/AuthContext.js`)
- Admin portal → Employee management: renders (evidence: `frontend/src/components/AdminLayout.js`)
- Employee management → REST API routes: requests data (evidence: `frontend/src/app/employees/page.js`)
- Attendance tracking → REST API routes: requests data (evidence: `frontend/src/app/attendance/page.js`)
- Worker self-service → REST API routes: requests data (evidence: `frontend/src/app/worker/page.js`)
- Express server → REST API routes: mounts routes (evidence: `backend/src/app.js`)
- REST API routes → Route authorization: applies guards (evidence: `backend/src/routes/api.js`)
- REST API routes → Employee management: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Attendance tracking: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Payroll and payslips: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Clients and contracts: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Invoice generation: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Expense management: dispatches (evidence: `backend/src/routes/api.js`)
- REST API routes → Reports and exports: dispatches (evidence: `backend/src/routes/api.js`)
- Employee management → Prisma client: reads and writes
- Clients and contracts → Prisma client: reads and writes (evidence: `backend/src/controllers/clientController.js`)
- Payroll and payslips → Prisma client: reads and writes (evidence: `backend/src/controllers/payrollController.js`)
- Payroll and payslips → Payroll calculation: calculates payroll (evidence: `backend/src/controllers/payrollController.js`)
- Payroll and payslips → PDF generation: generates payslips (evidence: `backend/src/controllers/payrollController.js`)
- Invoice generation → Prisma client: reads and writes (evidence: `backend/src/controllers/invoiceController.js`)
- Invoice generation → Invoice calculation: calculates invoice (evidence: `backend/src/controllers/invoiceController.js`)
- Invoice generation → PDF generation: generates invoice PDF (evidence: `backend/src/controllers/invoiceController.js`)
- Reports and exports → Prisma client: reads reports (evidence: `backend/src/controllers/reportsController.js`)
- Reports and exports → Excel exports: exports workbook (evidence: `backend/src/controllers/reportsController.js`)
- Prisma client → PostgreSQL: accesses (evidence: `README.md`)
