# piyu-sh4/m.tech-final-year-project architecture

> Architecture diagram of the GitHub repository piyu-sh4/m.tech-final-year-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/piyu-sh4/m.tech-final-year-project
- Repository: https://github.com/piyu-sh4/m.tech-final-year-project

## Overview

Workforce Intelligence is a role-aware workforce operations platform. Employees and managers use browser screens to access dashboards and workflows; the Express API applies authentication and role checks, then reads or updates workforce records. The catalog-driven modules cover people, time and pay, hiring and development, operations, and governance, alongside dedicated features such as chat, reporting, and administration. The README documents MySQL-backed workflows and Redis caching. Several subsystems are represented by their exact route or service directories because their implementation excerpts were not provided; links are limited to relationships shown in the excerpts or README.

Main entry points: [`backend/app.js`](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/app.js) (HTTP application), [`backend/routes/moduleRoutes.js`](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/routes/moduleRoutes.js) (Module workflows), [`backend/controllers/adminController.js`](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/controllers/adminController.js) (People administration), [`frontend`](https://github.com/piyu-sh4/m.tech-final-year-project/tree/main/frontend) (Browser screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_browser["Browser screens"]
end

subgraph group_api["API and access"]
  node_http["HTTP application<br/>[app.js]"]
  node_auth["Authentication<br/>[authMiddleware.js]"]
end

subgraph group_workforce["Workforce workflows"]
  node_catalog["Module catalog<br/>[moduleCatalog.js]"]
  node_module_api["Module workflows<br/>[moduleRoutes.js]"]
  node_admin["People administration<br/>[adminController.js]"]
  node_dedicated_workflows["Domain workflows"]
  node_workflow_rules["Workflow decisions"]
end

subgraph group_insights["Insights and collaboration"]
  node_chat["Workforce chat<br/>[chatController.js]"]
  node_analytics["Analytics and reports"]
  node_realtime["Live updates<br/>[socketServer.js]"]
end

subgraph group_state["Platform state"]
  node_database_layer["Database access<br/>[database.js]"]
  node_mysql[("MySQL records<br/>[db.js]")]
  node_cache[("Redis cache<br/>[cacheService.js]")]
end

node_users(("Workforce users"))
node_ai_services["AI providers"]

node_users -->|"uses"| node_browser
node_browser -->|"accesses API"| node_http
node_http -->|"protects routes"| node_auth
node_http -->|"serves module pages"| node_catalog
node_http -->|"mounts routes"| node_module_api
node_module_api -->|"protects requests"| node_auth
node_module_api -->|"reads definitions"| node_catalog
node_module_api -->|"reads and writes"| node_database_layer
node_http -->|"mounts routes"| node_dedicated_workflows
node_dedicated_workflows -->|"dispatches requests"| node_admin
node_admin -->|"uses decisions"| node_workflow_rules
node_admin -->|"broadcasts alerts"| node_realtime
node_database_layer -->|"queries"| node_mysql
node_http -->|"mounts chat routes"| node_chat
node_http -->|"mounts analytics routes"| node_analytics
node_http -.->|"starts sockets"| node_realtime
node_http -->|"connects cache"| node_cache
node_chat -.->|"uses providers"| node_ai_services

click node_browser "https://github.com/piyu-sh4/m.tech-final-year-project/tree/main/frontend"
click node_http "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/app.js"
click node_auth "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/middleware/authMiddleware.js"
click node_catalog "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/config/moduleCatalog.js"
click node_module_api "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/routes/moduleRoutes.js"
click node_admin "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/controllers/adminController.js"
click node_dedicated_workflows "https://github.com/piyu-sh4/m.tech-final-year-project/tree/main/backend/routes"
click node_workflow_rules "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/workforceDecisions.js"
click node_chat "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/controllers/chatController.js"
click node_analytics "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/analyticsService.js"
click node_realtime "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/socketServer.js"
click node_database_layer "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/database.js"
click node_mysql "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/config/db.js"
click node_cache "https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/cacheService.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_browser,node_users toneBlue
class node_http,node_auth toneAmber
class node_catalog,node_module_api,node_admin,node_dedicated_workflows,node_workflow_rules toneMint
class node_chat,node_analytics,node_realtime toneRose
class node_database_layer,node_mysql,node_cache,node_ai_services toneIndigo
```

## Components

### User experience

- [Browser screens](https://github.com/piyu-sh4/m.tech-final-year-project/tree/main/frontend): `frontend`

### API and access

- [HTTP application](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/app.js): `backend/app.js`
- [Authentication](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Workforce workflows

- [Module catalog](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/config/moduleCatalog.js): `backend/config/moduleCatalog.js`
- [Module workflows](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/routes/moduleRoutes.js): `backend/routes/moduleRoutes.js`
- [People administration](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`
- [Domain workflows](https://github.com/piyu-sh4/m.tech-final-year-project/tree/main/backend/routes): `backend/routes`
- [Workflow decisions](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/workforceDecisions.js): `backend/services/workforceDecisions.js`

### Insights and collaboration

- [Workforce chat](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Analytics and reports](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/analyticsService.js): `backend/services/analyticsService.js`
- [Live updates](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/socketServer.js): `backend/socketServer.js`

### Platform state

- [Database access](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/database.js): `backend/services/database.js`
- [MySQL records](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/config/db.js): `backend/config/db.js`
- [Redis cache](https://github.com/piyu-sh4/m.tech-final-year-project/blob/main/backend/services/cacheService.js): `backend/services/cacheService.js`

### Other components

- **Workforce users**
- **AI providers**

## Connections

- Workforce users → Browser screens: uses (evidence: `README.md`)
- Browser screens → HTTP application: accesses API (evidence: `README.md`)
- HTTP application → Authentication: protects routes (evidence: `backend/app.js`)
- HTTP application → Module catalog: serves module pages (evidence: `backend/app.js`)
- HTTP application → Module workflows: mounts routes (evidence: `backend/app.js`)
- Module workflows → Authentication: protects requests (evidence: `backend/routes/moduleRoutes.js`)
- Module workflows → Module catalog: reads definitions (evidence: `backend/routes/moduleRoutes.js`)
- Module workflows → Database access: reads and writes (evidence: `backend/routes/moduleRoutes.js`)
- HTTP application → Domain workflows: mounts routes (evidence: `backend/app.js`)
- Domain workflows → People administration: dispatches requests (evidence: `backend/routes/adminRoutes.js`)
- People administration → Workflow decisions: uses decisions (evidence: `backend/controllers/adminController.js`)
- People administration → Live updates: broadcasts alerts (evidence: `backend/controllers/adminController.js`)
- Database access → MySQL records: queries (evidence: `backend/services/database.js`)
- HTTP application → Workforce chat: mounts chat routes (evidence: `backend/app.js`)
- HTTP application → Analytics and reports: mounts analytics routes (evidence: `backend/app.js`)
- HTTP application → Live updates: starts sockets
- HTTP application → Redis cache: connects cache (evidence: `backend/server.js`)
- Workforce chat → AI providers: uses providers
