# pratikrrajput2006-ship-it/complaint-management-system architecture

> Architecture diagram of the GitHub repository pratikrrajput2006-ship-it/complaint-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pratikrrajput2006-ship-it/complaint-management-system
- Repository: https://github.com/pratikrrajput2006-ship-it/complaint-management-system

## Overview

CMS is a role-based complaint-management web application. Students and Staff submit and track complaints; the backend routes them to Higher Authority (HA) review or Admin fallback, supports proposed solutions and submitter responses, and records feedback and notifications. Admins also manage departments, categories, users, and HA assignments. The graph follows the documented REST architecture and sampled route/controller wiring; some frontend and controller internals were not sampled, so uncertain links are omitted.

Main entry points: [`Backend/config/db.js`](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/config/db.js) (MySQL database), [`Backend/server.js`](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/server.js) (Express server), [`Backend/routes/staffRouter.js`](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/staffRouter.js) (Staff and HA routes), [`Backend/routes/adminRouter.js`](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/adminRouter.js) (Admin routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Role interfaces"]
  node_student["Student interface"]
  node_staff["Staff interface"]
  node_admin["Admin interface<br/>[complaints.js]"]
end

subgraph group_api["API and access"]
  node_server["Express server<br/>[server.js]"]
  node_student_routes["Student routes<br/>[studentRouter.js]"]
  node_staff_routes["Staff and HA routes<br/>[staffRouter.js]"]
  node_admin_routes["Admin routes<br/>[adminRouter.js]"]
  node_auth["Authentication<br/>[authmiddleware.js]"]
end

subgraph group_workflow["Complaint workflow"]
  node_student_ops["Student accounts"]
  node_staff_ops["Staff accounts<br/>[staffController.js]"]
  node_complaints["Complaint submission and response"]
  node_ha_review["HA review and escalation<br/>[haController.js]"]
  node_admin_review["Admin complaint review"]
  node_attachments["Private attachments"]
  node_scheduler["Response deadline scheduler"]
end

subgraph group_operations["Administration and services"]
  node_admin_mgmt["Departments and HA management<br/>[adminController.js]"]
  node_promotion["Admin promotion"]
  node_feedback["Complaint feedback"]
  node_notifications["In-app notifications"]
  node_notify_helper["Notification helper"]
  node_reports["Admin reports"]
  node_db[("MySQL database<br/>[db.js]")]
end

node_student_actor(("Student"))
node_staff_actor(("Staff"))
node_admin_actor(("Admin"))

node_student_actor -->|"uses"| node_student
node_staff_actor -->|"uses"| node_staff
node_admin_actor -->|"uses"| node_admin
node_student -->|"calls REST API"| node_server
node_staff -->|"calls REST API"| node_server
node_admin -->|"calls REST API"| node_server
node_server -->|"mounts"| node_student_routes
node_server -->|"mounts"| node_staff_routes
node_server -->|"mounts"| node_admin_routes
node_server -->|"starts"| node_scheduler
node_student_routes -->|"checks identity"| node_auth
node_staff_routes -->|"checks identity"| node_auth
node_admin_routes -->|"checks identity"| node_auth
node_student_routes -->|"routes account actions"| node_student_ops
node_staff_routes -->|"routes account actions"| node_staff_ops
node_student_routes -->|"routes complaint actions"| node_complaints
node_staff_routes -->|"routes complaint actions"| node_complaints
node_staff_routes -->|"routes HA actions"| node_ha_review
node_admin_routes -->|"routes complaint actions"| node_admin_review
node_admin_routes -->|"routes management actions"| node_admin_mgmt
node_admin_routes -->|"routes promotion"| node_promotion
node_student_routes -->|"routes downloads"| node_attachments
node_staff_routes -->|"routes downloads"| node_attachments
node_admin_routes -->|"routes downloads"| node_attachments
node_student_routes -->|"routes feedback"| node_feedback
node_staff_routes -->|"routes feedback"| node_feedback
node_admin_routes -->|"routes reports"| node_reports
node_server -->|"mounts notification routes"| node_notifications
node_complaints -->|"creates notifications"| node_notify_helper
node_ha_review -->|"creates notifications"| node_notify_helper
node_admin_review -->|"creates notifications"| node_notify_helper
node_admin_mgmt -->|"creates notifications"| node_notify_helper
node_complaints -->|"reads and writes"| node_db
node_ha_review -->|"reads and writes"| node_db
node_admin_review -->|"reads and writes"| node_db
node_admin_mgmt -->|"reads and writes"| node_db
node_attachments -->|"checks permissions"| node_db
node_scheduler -->|"checks deadlines"| node_db
node_scheduler -->|"sends reminders"| node_notify_helper
node_notify_helper -->|"persists notifications"| node_db
node_notifications -->|"reads notifications"| node_db
node_feedback -->|"reads and writes"| node_db
node_reports -->|"queries reports"| node_db
node_promotion -->|"updates accounts"| node_db

click node_student "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Student/submit-complaint.js"
click node_staff "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Staff/submit-complaint.js"
click node_admin "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Admin/complaints.js"
click node_server "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/server.js"
click node_student_routes "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/studentRouter.js"
click node_staff_routes "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/staffRouter.js"
click node_admin_routes "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/adminRouter.js"
click node_auth "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/middleware/authmiddleware.js"
click node_student_ops "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/studentController.js"
click node_staff_ops "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/staffController.js"
click node_complaints "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/complaintController.js"
click node_ha_review "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/haController.js"
click node_admin_review "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminComplaintController.js"
click node_attachments "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/attachmentController.js"
click node_scheduler "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/utils/studentResponseScheduler.js"
click node_admin_mgmt "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminController.js"
click node_promotion "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminPromotionController.js"
click node_feedback "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/feedbackController.js"
click node_notifications "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/notificationController.js"
click node_notify_helper "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/utils/notificationHelper.js"
click node_reports "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminReportController.js"
click node_db "https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/config/db.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_student,node_staff,node_admin toneBlue
class node_server,node_student_routes,node_staff_routes,node_admin_routes,node_auth toneAmber
class node_student_ops,node_staff_ops,node_complaints,node_ha_review,node_admin_review,node_attachments,node_scheduler toneMint
class node_admin_mgmt,node_promotion,node_feedback,node_notifications,node_notify_helper,node_reports,node_db toneRose
class node_student_actor,node_staff_actor,node_admin_actor toneIndigo
```

## Components

### Role interfaces

- [Student interface](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Student/submit-complaint.js): `frontend/JS/Student/submit-complaint.js`
- [Staff interface](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Staff/submit-complaint.js): `frontend/JS/Staff/submit-complaint.js`
- [Admin interface](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/frontend/JS/Admin/complaints.js): `frontend/JS/Admin/complaints.js`

### API and access

- [Express server](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/server.js): `Backend/server.js`
- [Student routes](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/studentRouter.js): `Backend/routes/studentRouter.js`
- [Staff and HA routes](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/staffRouter.js): `Backend/routes/staffRouter.js`
- [Admin routes](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/routes/adminRouter.js): `Backend/routes/adminRouter.js`
- [Authentication](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/middleware/authmiddleware.js): `Backend/middleware/authmiddleware.js`

### Complaint workflow

- [Student accounts](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/studentController.js): `Backend/controller/studentController.js`
- [Staff accounts](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/staffController.js): `Backend/controller/staffController.js`
- [Complaint submission and response](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/complaintController.js): `Backend/controller/complaintController.js`
- [HA review and escalation](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/haController.js): `Backend/controller/haController.js`
- [Admin complaint review](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminComplaintController.js): `Backend/controller/adminComplaintController.js`
- [Private attachments](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/attachmentController.js): `Backend/controller/attachmentController.js`
- [Response deadline scheduler](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/utils/studentResponseScheduler.js): `Backend/utils/studentResponseScheduler.js`

### Administration and services

- [Departments and HA management](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminController.js): `Backend/controller/adminController.js`
- [Admin promotion](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminPromotionController.js): `Backend/controller/adminPromotionController.js`
- [Complaint feedback](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/feedbackController.js): `Backend/controller/feedbackController.js`
- [In-app notifications](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/notificationController.js): `Backend/controller/notificationController.js`
- [Notification helper](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/utils/notificationHelper.js): `Backend/utils/notificationHelper.js`
- [Admin reports](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/controller/adminReportController.js): `Backend/controller/adminReportController.js`
- [MySQL database](https://github.com/pratikrrajput2006-ship-it/complaint-management-system/blob/main/Backend/config/db.js): `Backend/config/db.js`

### Other components

- **Student**
- **Staff**
- **Admin**

## Connections

- Student → Student interface: uses
- Staff → Staff interface: uses
- Admin → Admin interface: uses
- Student interface → Express server: calls REST API
- Staff interface → Express server: calls REST API
- Admin interface → Express server: calls REST API
- Express server → Student routes: mounts (evidence: `Backend/server.js`)
- Express server → Staff and HA routes: mounts (evidence: `Backend/server.js`)
- Express server → Admin routes: mounts (evidence: `Backend/server.js`)
- Express server → Response deadline scheduler: starts (evidence: `Backend/server.js`)
- Student routes → Authentication: checks identity (evidence: `Backend/routes/studentRouter.js`)
- Staff and HA routes → Authentication: checks identity (evidence: `Backend/routes/staffRouter.js`)
- Admin routes → Authentication: checks identity (evidence: `Backend/routes/adminRouter.js`)
- Student routes → Student accounts: routes account actions (evidence: `Backend/routes/studentRouter.js`)
- Staff and HA routes → Staff accounts: routes account actions (evidence: `Backend/routes/staffRouter.js`)
- Student routes → Complaint submission and response: routes complaint actions (evidence: `Backend/routes/studentRouter.js`)
- Staff and HA routes → Complaint submission and response: routes complaint actions (evidence: `Backend/routes/staffRouter.js`)
- Staff and HA routes → HA review and escalation: routes HA actions (evidence: `Backend/routes/staffRouter.js`)
- Admin routes → Admin complaint review: routes complaint actions (evidence: `Backend/routes/adminRouter.js`)
- Admin routes → Departments and HA management: routes management actions (evidence: `Backend/routes/adminRouter.js`)
- Admin routes → Admin promotion: routes promotion (evidence: `Backend/routes/adminRouter.js`)
- Student routes → Private attachments: routes downloads (evidence: `Backend/routes/studentRouter.js`)
- Staff and HA routes → Private attachments: routes downloads (evidence: `Backend/routes/staffRouter.js`)
- Admin routes → Private attachments: routes downloads (evidence: `Backend/routes/adminRouter.js`)
- Student routes → Complaint feedback: routes feedback (evidence: `Backend/routes/studentRouter.js`)
- Staff and HA routes → Complaint feedback: routes feedback (evidence: `Backend/routes/staffRouter.js`)
- Admin routes → Admin reports: routes reports (evidence: `Backend/routes/adminRouter.js`)
- Express server → In-app notifications: mounts notification routes (evidence: `Backend/server.js`)
- Complaint submission and response → Notification helper: creates notifications (evidence: `Backend/controller/complaintController.js`)
- HA review and escalation → Notification helper: creates notifications (evidence: `Backend/controller/haController.js`)
- Admin complaint review → Notification helper: creates notifications (evidence: `Backend/controller/adminComplaintController.js`)
- Departments and HA management → Notification helper: creates notifications (evidence: `Backend/controller/adminController.js`)
- Complaint submission and response → MySQL database: reads and writes (evidence: `Backend/controller/complaintController.js`)
- HA review and escalation → MySQL database: reads and writes (evidence: `Backend/controller/haController.js`)
- Admin complaint review → MySQL database: reads and writes (evidence: `Backend/controller/adminComplaintController.js`)
- Departments and HA management → MySQL database: reads and writes (evidence: `Backend/controller/adminController.js`)
- Private attachments → MySQL database: checks permissions (evidence: `Backend/controller/attachmentController.js`)
- Response deadline scheduler → MySQL database: checks deadlines (evidence: `Backend/utils/studentResponseScheduler.js`)
- Response deadline scheduler → Notification helper: sends reminders (evidence: `Backend/utils/studentResponseScheduler.js`)
- Notification helper → MySQL database: persists notifications (evidence: `Backend/utils/notificationHelper.js`)
- In-app notifications → MySQL database: reads notifications (evidence: `Backend/controller/notificationController.js`)
- Complaint feedback → MySQL database: reads and writes (evidence: `Backend/controller/feedbackController.js`)
- Admin reports → MySQL database: queries reports (evidence: `Backend/controller/adminReportController.js`)
- Admin promotion → MySQL database: updates accounts (evidence: `Backend/controller/adminPromotionController.js`)
