# sarvani1947-cmd/smart-campus-management-system architecture

> Architecture diagram of the GitHub repository sarvani1947-cmd/smart-campus-management-system, 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/sarvani1947-cmd/smart-campus-management-system
- Repository: https://github.com/sarvani1947-cmd/smart-campus-management-system

## Overview

This is a MERN college-management application with role-based access and an admin-operated timetable generator. The main timetable workflow accepts uploaded academic CSVs, parses and validates them, searches for a CSP schedule, independently verifies it, saves it as a draft, and supports viewing and publishing. The wider product also manages classes, students, subjects, teachers, attendance, and exam results, with separate student and teacher views. Edges follow shown route/controller calls or explicit README capabilities; unsampled frontend/API wiring is left unverified where necessary.

Main entry points: [`server/routes/route.js`](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/routes/route.js) (REST routes), [`server/controllers/timetableController.js`](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetableController.js) (Generate timetable), [`client/src/pages/admin/AdminDashboard.js`](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/admin/AdminDashboard.js) (Admin dashboard), [`client/src/App.js`](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/App.js) (Role router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and roles"]
  node_app["Role router<br/>[App.js]"]
  node_login["Role login<br/>[LoginPage.js]"]
  node_authstate["Auth requests and state<br/>[userHandle.js]"]
end

subgraph group_administration["Academic administration"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.js]"]
  node_classui["Class management"]
  node_studentui["Student management"]
  node_subjectui["Subject management"]
  node_teacherui["Teacher management"]
end

subgraph group_timetable["Timetable generation"]
  node_admin_timetable["Timetable workspace<br/>[AdminTimetable.js]"]
  node_csv_parser["CSV parsing<br/>[csv-parser.js]"]
  node_data_validator["Input validation"]
  node_solver["CSP solver<br/>[solver.js]"]
  node_verifier["Independent verifier<br/>[verifyTimetable.js]"]
  node_timetable_api["Generate timetable"]
  node_timetable_views["Timetable read and publish"]
  node_publish_api["Publish timetable"]
end

subgraph group_backend["API and persistence"]
  node_api_routes["REST routes<br/>[route.js]"]
  node_admin_controller["Admin account API"]
  node_student_controller["Student and attendance API"]
  node_teacher_controller["Teacher API"]
  node_class_controller["Class API"]
  node_subject_controller["Subject API"]
  node_account_store[("Account and academic records<br/>[studentSchema.js]")]
  node_timetable_store[("Timetable records<br/>[timetableSchema.js]")]
  node_teacher_schema[("Teacher records<br/>[teacherSchema.js]")]
  node_subject_schema[("Subject records<br/>[subjectSchema.js]")]
end

subgraph group_portals["Student and teacher portals"]
  node_studentportal["Student portal"]
  node_teacherportal["Teacher portal"]
  node_attendance_helpers["Attendance and charts"]
  node_pie_chart["Pie chart<br/>[CustomPieChart.js]"]
  node_popup["Feedback popup<br/>[Popup.js]"]
end

node_visitor(("Visitor or user"))

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_adminui
node_app -->|"routes to"| node_studentportal
node_app -->|"routes to"| node_teacherportal
node_login -->|"dispatches"| node_authstate
node_authstate -->|"HTTP requests"| node_api_routes
node_adminui -->|"navigates"| node_classui
node_adminui -->|"navigates"| node_studentui
node_adminui -->|"navigates"| node_subjectui
node_adminui -->|"navigates"| node_teacherui
node_adminui -->|"navigates"| node_admin_timetable
node_admin_timetable -.->|"uses generation API"| node_timetable_api
node_studentportal -.->|"calculates attendance"| node_attendance_helpers
node_teacherportal -->|"calculates attendance"| node_attendance_helpers
node_teacherportal -->|"renders"| node_pie_chart
node_api_routes -->|"routes account requests"| node_admin_controller
node_api_routes -->|"routes student requests"| node_student_controller
node_api_routes -->|"routes teacher requests"| node_teacher_controller
node_api_routes -->|"routes class requests"| node_class_controller
node_api_routes -->|"routes subject requests"| node_subject_controller
node_api_routes -->|"routes generation"| node_timetable_api
node_api_routes -->|"routes viewing"| node_timetable_views
node_api_routes -->|"routes publishing"| node_publish_api
node_timetable_api -->|"parses uploads"| node_csv_parser
node_timetable_api -->|"validates data"| node_data_validator
node_timetable_api -->|"generates schedule"| node_solver
node_timetable_api -->|"verifies schedule"| node_verifier
node_timetable_api -->|"saves draft"| node_timetable_store
node_timetable_views -->|"reads schedule"| node_timetable_store
node_publish_api -->|"updates status"| node_timetable_store
node_student_controller -->|"reads and updates"| node_account_store
node_teacher_controller -->|"reads and updates"| node_teacher_schema
node_teacher_controller -->|"updates assignment"| node_subject_schema
node_subject_controller -->|"reads and updates"| node_subject_schema
node_subject_controller -->|"updates assignments"| node_teacher_schema
node_subject_controller -->|"updates student records"| node_account_store
node_studentui -.->|"uses attendance metrics"| node_attendance_helpers
node_studentui -->|"shows feedback"| node_popup

click node_app "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/App.js"
click node_login "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/LoginPage.js"
click node_authstate "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/redux/userRelated/userHandle.js"
click node_adminui "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/admin/AdminDashboard.js"
click node_admin_timetable "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/admin/AdminTimetable.js"
click node_classui "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/classRelated"
click node_studentui "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/studentRelated"
click node_subjectui "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/subjectRelated"
click node_teacherui "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/teacherRelated"
click node_studentportal "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/student"
click node_teacherportal "https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/teacher"
click node_attendance_helpers "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/attendanceCalculator.js"
click node_api_routes "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/routes/route.js"
click node_admin_controller "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/admin-controller.js"
click node_student_controller "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/student_controller.js"
click node_teacher_controller "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/teacher-controller.js"
click node_class_controller "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/class-controller.js"
click node_subject_controller "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/subject-controller.js"
click node_csv_parser "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/utils/csv-parser.js"
click node_data_validator "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/utils/timetable-validator.js"
click node_solver "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/timetable-solver/solver.js"
click node_verifier "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/timetable-solver/verifyTimetable.js"
click node_timetable_api "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetableController.js"
click node_timetable_views "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetableViewController.js"
click node_publish_api "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetablePublishController.js"
click node_account_store "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/studentSchema.js"
click node_timetable_store "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/timetableSchema.js"
click node_teacher_schema "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/teacherSchema.js"
click node_subject_schema "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/subjectSchema.js"
click node_pie_chart "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/CustomPieChart.js"
click node_popup "https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/Popup.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_app,node_login,node_authstate,node_visitor toneBlue
class node_adminui,node_classui,node_studentui,node_subjectui,node_teacherui toneAmber
class node_admin_timetable,node_csv_parser,node_data_validator,node_solver,node_verifier,node_timetable_api,node_timetable_views,node_publish_api toneMint
class node_api_routes,node_admin_controller,node_student_controller,node_teacher_controller,node_class_controller,node_subject_controller,node_account_store,node_timetable_store,node_teacher_schema,node_subject_schema toneRose
class node_studentportal,node_teacherportal,node_attendance_helpers,node_pie_chart,node_popup toneIndigo
```

## Components

### Access and roles

- [Role router](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/App.js): `client/src/App.js`
- [Role login](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/LoginPage.js): `client/src/pages/LoginPage.js`
- [Auth requests and state](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/redux/userRelated/userHandle.js): `client/src/redux/userRelated/userHandle.js`

### Academic administration

- [Admin dashboard](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/admin/AdminDashboard.js): `client/src/pages/admin/AdminDashboard.js`
- [Class management](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/classRelated): `client/src/pages/admin/classRelated`
- [Student management](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/studentRelated): `client/src/pages/admin/studentRelated`
- [Subject management](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/subjectRelated): `client/src/pages/admin/subjectRelated`
- [Teacher management](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/admin/teacherRelated): `client/src/pages/admin/teacherRelated`

### Timetable generation

- [Timetable workspace](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/pages/admin/AdminTimetable.js): `client/src/pages/admin/AdminTimetable.js`
- [CSV parsing](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/utils/csv-parser.js): `server/utils/csv-parser.js`
- [Input validation](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/utils/timetable-validator.js): `server/utils/timetable-validator.js`
- [CSP solver](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/timetable-solver/solver.js): `server/timetable-solver/solver.js`
- [Independent verifier](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/timetable-solver/verifyTimetable.js): `server/timetable-solver/verifyTimetable.js`
- [Generate timetable](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetableController.js): `server/controllers/timetableController.js`
- [Timetable read and publish](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetableViewController.js): `server/controllers/timetableViewController.js`
- [Publish timetable](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/timetablePublishController.js): `server/controllers/timetablePublishController.js`

### API and persistence

- [REST routes](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/routes/route.js): `server/routes/route.js`
- [Admin account API](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/admin-controller.js): `server/controllers/admin-controller.js`
- [Student and attendance API](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/student_controller.js): `server/controllers/student_controller.js`
- [Teacher API](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/teacher-controller.js): `server/controllers/teacher-controller.js`
- [Class API](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/class-controller.js): `server/controllers/class-controller.js`
- [Subject API](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/controllers/subject-controller.js): `server/controllers/subject-controller.js`
- [Account and academic records](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/studentSchema.js): `server/models/studentSchema.js`
- [Timetable records](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/timetableSchema.js): `server/models/timetableSchema.js`
- [Teacher records](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/teacherSchema.js): `server/models/teacherSchema.js`
- [Subject records](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/server/models/subjectSchema.js): `server/models/subjectSchema.js`

### Student and teacher portals

- [Student portal](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/student): `client/src/pages/student`
- [Teacher portal](https://github.com/sarvani1947-cmd/smart-campus-management-system/tree/main/client/src/pages/teacher): `client/src/pages/teacher`
- [Attendance and charts](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/attendanceCalculator.js): `client/src/components/attendanceCalculator.js`
- [Pie chart](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/CustomPieChart.js): `client/src/components/CustomPieChart.js`
- [Feedback popup](https://github.com/sarvani1947-cmd/smart-campus-management-system/blob/main/client/src/components/Popup.js): `client/src/components/Popup.js`

### Other components

- **Visitor or user**

## Connections

- Visitor or user → Role router: opens (evidence: `client/src/App.js`)
- Role router → Role login: routes to (evidence: `client/src/App.js`)
- Role router → Admin dashboard: routes to (evidence: `client/src/App.js`)
- Role router → Student portal: routes to (evidence: `client/src/App.js`)
- Role router → Teacher portal: routes to (evidence: `client/src/App.js`)
- Role login → Auth requests and state: dispatches (evidence: `client/src/pages/LoginPage.js`)
- Auth requests and state → REST routes: HTTP requests (evidence: `client/src/redux/userRelated/userHandle.js`)
- Admin dashboard → Class management: navigates (evidence: `client/src/pages/admin/AdminDashboard.js`)
- Admin dashboard → Student management: navigates (evidence: `client/src/pages/admin/AdminDashboard.js`)
- Admin dashboard → Subject management: navigates (evidence: `client/src/pages/admin/AdminDashboard.js`)
- Admin dashboard → Teacher management: navigates (evidence: `client/src/pages/admin/AdminDashboard.js`)
- Admin dashboard → Timetable workspace: navigates (evidence: `client/src/pages/admin/AdminDashboard.js`)
- Timetable workspace → Generate timetable: uses generation API
- Student portal → Attendance and charts: calculates attendance
- Teacher portal → Attendance and charts: calculates attendance (evidence: `client/src/pages/teacher/TeacherViewStudent.js`)
- Teacher portal → Pie chart: renders (evidence: `client/src/pages/teacher/TeacherViewStudent.js`)
- REST routes → Admin account API: routes account requests (evidence: `server/routes/route.js`)
- REST routes → Student and attendance API: routes student requests (evidence: `server/routes/route.js`)
- REST routes → Teacher API: routes teacher requests (evidence: `server/routes/route.js`)
- REST routes → Class API: routes class requests (evidence: `server/routes/route.js`)
- REST routes → Subject API: routes subject requests (evidence: `server/routes/route.js`)
- REST routes → Generate timetable: routes generation (evidence: `server/routes/route.js`)
- REST routes → Timetable read and publish: routes viewing (evidence: `server/routes/route.js`)
- REST routes → Publish timetable: routes publishing (evidence: `server/routes/route.js`)
- Generate timetable → CSV parsing: parses uploads (evidence: `server/controllers/timetableController.js`)
- Generate timetable → Input validation: validates data (evidence: `server/controllers/timetableController.js`)
- Generate timetable → CSP solver: generates schedule (evidence: `server/controllers/timetableController.js`)
- Generate timetable → Independent verifier: verifies schedule (evidence: `server/controllers/timetableController.js`)
- Generate timetable → Timetable records: saves draft (evidence: `server/controllers/timetableController.js`)
- Timetable read and publish → Timetable records: reads schedule (evidence: `server/controllers/timetableViewController.js`)
- Publish timetable → Timetable records: updates status (evidence: `server/controllers/timetablePublishController.js`)
- Student and attendance API → Account and academic records: reads and updates (evidence: `server/controllers/student_controller.js`)
- Teacher API → Teacher records: reads and updates (evidence: `server/controllers/teacher-controller.js`)
- Teacher API → Subject records: updates assignment (evidence: `server/controllers/teacher-controller.js`)
- Subject API → Subject records: reads and updates (evidence: `server/controllers/subject-controller.js`)
- Subject API → Teacher records: updates assignments (evidence: `server/controllers/subject-controller.js`)
- Subject API → Account and academic records: updates student records (evidence: `server/controllers/subject-controller.js`)
- Student management → Attendance and charts: uses attendance metrics (evidence: `client/src/pages/admin/studentRelated/ViewStudent.js`)
- Student management → Feedback popup: shows feedback (evidence: `client/src/pages/admin/studentRelated/ViewStudent.js`)
