# ayusmannanda/college-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/ayusmannanda/college-management-system
- Repository: https://github.com/ayusmannanda/college-management-system

## Overview

#### 1. System Purpose and Delivery Surfaces
Axiom is a role-based college-management system for administration, faculty, and students. One React SPA is delivered as web/PWA and wrapped for Android and Electron desktop. The SPA consumes a separate Express REST API backed by MySQL.
- `frontend/src/main.jsx`
- `frontend/src/App.jsx`
- `backend/server.js`

#### 2. Frontend Composition and Role Portals
The React application is organized around distinct Admin, Faculty, and Student page groups, with shared dashboard layout/UI components. Login, OAuth completion, and marksheet verification are cross-role entry flows. Protected routing gates client navigation; server authorization remains the enforcement boundary.
- `frontend/src/pages/Login.jsx`
- `frontend/src/pages/Admin/AdminLayout.jsx`
- `frontend/src/pages/Faculty/FacultyLayout.jsx`
- `frontend/src/pages/Student/StudentLayout.jsx`
- `frontend/src/routes/ProtectedRoute.jsx`

#### 3. API Bootstrap, Routing, and Persistence Boundary
Express starts from `backend/server.js`, builds the application in `backend/src/app.js`, and exposes domain route groups that delegate to controllers. Controllers are the business/API boundary to the MySQL connection; the relational schema defines students, faculty, courses, subjects, assignments, attendance, marks, results, and roll generation.
- `backend/server.js`
- `backend/src/app.js`
- `backend/src/config/db.js`
- `sql/schema.sql`

#### 4. Identity and Authorization Flow
Credentials and Google OAuth enter through auth routes/controllers. JWT authentication middleware establishes caller identity, and role middleware limits operations to Admin, Faculty, or Student privileges. This boundary protects management, record-entry, and self-service endpoints; faculty date restrictions for attendance are enforced server-side.
- `backend/src/routes/authRoutes.js`
- `backend/src/controllers/authController.js`
- `backend/src/middleware/authMiddleware.js`
- `backend/src/middleware/roleAuthMiddleware.js`

#### 5. Academic Master Data and Assignment
Admin workflows manage the authoritative academic structure: courses, subjects, student/faculty accounts, and faculty-to-subject/class assignments. Assignment data drives the scoped faculty attendance and marks workflows, while students are associated with course/semester records.
- `backend/src/controllers/courseController.js`
- `backend/src/controllers/subjectController.js`
- `backend/src/controllers/assignController.js`
- `backend/src/controllers/studentController.js`
- `backend/src/controllers/facultyController.js`

#### 6. Attendance, Marks, and Reporting Pipeline
Authorized Admin/Faculty users submit or edit attendance and marks against student/subject/course context. Dedicated controllers serve reports, student-facing attendance/marks views, and dashboards. Frontend role pages render the corresponding capture, report, and self-service experiences through the shared API client.
- `backend/src/controllers/attendanceController.js`
- `backend/src/controllers/marksController.js`
- `backend/src/controllers/studentAttendanceController.js`
- `backend/src/controllers/studentMarksheetController.js`
- `frontend/src/utils/api.js`

#### 7. Marksheet Verification and File Assets
Marksheet presentation is generated client-side, including SHA-256-derived verification data and QR links to the verification route; backend verification resolves authenticity data. Backend-managed uploads hold profile photos and institutional assets used by profiles and printed marksheets.
- `frontend/src/pages/Admin/PrintMarksheet.jsx`
- `frontend/src/pages/VerifyMarksheet.jsx`
- `backend/src/controllers/verifyController.js`
- `backend/uploads/`

#### 8. Runtime, Packaging, and Infrastructure
The material runtimes are Node.js/Express, React/Vite, and MySQL. Deployment separates frontend (Vercel), backend (Render), and database (Railway). Capacitor packages the built frontend into Android; Electron provides desktop main/preload processes. External identity is Google OAuth; spreadsheet workflows use import/export UI and backend record APIs.
- `frontend/capacitor.config.json`
- `frontend/android/app/src/main/java/com/college/cms/MainActivity.java`
- `frontend/electron/main.js`
- `.github/workflows/build.yml`

Main entry points: [`backend/src/middleware/authMiddleware.js`](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/middleware/authMiddleware.js) (JWT & role authorization), [`frontend/src/main.jsx`](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/main.jsx) (React SPA entry), [`backend/src/config/db.js`](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/config/db.js) (MySQL connection), [`backend/src/app.js`](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/app.js) (Express application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React clients"]
  node_spa_entry["React SPA entry<br/>React/Vite<br/>[main.jsx]"]
  node_app_shell["Application shell<br/>React app<br/>[App.jsx]"]
  node_protected_routes["Protected routes<br/>route guard<br/>[ProtectedRoute.jsx]"]
  node_role_portals["Role portals<br/>[AdminLayout.jsx]"]
  node_api_client["API client<br/>frontend HTTP client<br/>[api.js]"]
  node_marksheet_ui["Marksheet &amp; verification UI<br/>React pages<br/>[PrintMarksheet.jsx]"]
end

subgraph group_api["Express API"]
  node_api_server["Express server<br/>Node.js runtime<br/>[server.js]"]
  node_express_app["Express application<br/>API composition<br/>[app.js]"]
  node_auth_api["Authentication API<br/>routes + controller<br/>[authRoutes.js]"]
  node_access_control["JWT &amp; role authorization<br/>Express middleware<br/>[authMiddleware.js]"]
  node_academic_api["Academic master data<br/>controllers"]
  node_records_api["Attendance &amp; marks API<br/>controllers"]
  node_verification_api["Marksheet verification API<br/>controller"]
end

subgraph group_data["Academic data"]
  node_mysql[("MySQL connection<br/>persistence adapter<br/>[db.js]")]
  node_schema[("Academic schema<br/>MySQL schema<br/>[schema.sql]")]
  node_uploads["Managed uploads<br/>file assets"]
end

subgraph group_delivery["Packaging &amp; delivery"]
  node_capacitor_android["Android package<br/>Capacitor runtime"]
  node_electron["Desktop package<br/>Electron main process<br/>[main.js]"]
  node_build_pipeline["Build pipeline<br/>GitHub Actions<br/>[build.yml]"]
end

node_google_oauth(("Google OAuth<br/>external identity"))

node_spa_entry -->|"mounts"| node_app_shell
node_app_shell -->|"uses"| node_protected_routes
node_protected_routes -->|"admits role views"| node_role_portals
node_role_portals -->|"calls"| node_api_client
node_marksheet_ui -->|"verifies through"| node_api_client
node_api_client -->|"REST"| node_api_server
node_api_server -->|"starts"| node_express_app
node_express_app -->|"mounts"| node_auth_api
node_express_app -->|"applies"| node_access_control
node_access_control -->|"protects"| node_academic_api
node_access_control -->|"protects"| node_records_api
node_access_control -.->|"protects"| node_verification_api
node_auth_api -->|"OAuth"| node_google_oauth
node_academic_api -->|"reads and writes"| node_mysql
node_records_api -->|"reads and writes"| node_mysql
node_verification_api -->|"resolves"| node_mysql
node_mysql -->|"implements"| node_schema
node_academic_api -->|"manages assets"| node_uploads
node_spa_entry -->|"packaged as"| node_capacitor_android
node_spa_entry -->|"wrapped by"| node_electron
node_build_pipeline -->|"builds"| node_spa_entry
node_build_pipeline -->|"builds"| node_api_server

click node_spa_entry "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/main.jsx"
click node_app_shell "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/App.jsx"
click node_protected_routes "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/routes/ProtectedRoute.jsx"
click node_role_portals "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/pages/Admin/AdminLayout.jsx"
click node_api_client "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/utils/api.js"
click node_marksheet_ui "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/pages/Admin/PrintMarksheet.jsx"
click node_api_server "https://github.com/ayusmannanda/college-management-system/blob/main/backend/server.js"
click node_express_app "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/app.js"
click node_auth_api "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/routes/authRoutes.js"
click node_access_control "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/middleware/authMiddleware.js"
click node_academic_api "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/courseController.js"
click node_records_api "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/attendanceController.js"
click node_verification_api "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/verifyController.js"
click node_mysql "https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/config/db.js"
click node_schema "https://github.com/ayusmannanda/college-management-system/blob/main/sql/schema.sql"
click node_uploads "https://github.com/ayusmannanda/college-management-system/tree/main/backend/uploads"
click node_capacitor_android "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/capacitor.config.json"
click node_electron "https://github.com/ayusmannanda/college-management-system/blob/main/frontend/electron/main.js"
click node_build_pipeline "https://github.com/ayusmannanda/college-management-system/blob/main/.github/workflows/build.yml"

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_spa_entry,node_app_shell,node_protected_routes,node_role_portals,node_api_client,node_marksheet_ui toneBlue
class node_api_server,node_express_app,node_auth_api,node_access_control,node_academic_api,node_records_api,node_verification_api toneAmber
class node_mysql,node_schema,node_uploads toneMint
class node_capacitor_android,node_electron,node_build_pipeline toneRose
class node_google_oauth toneNeutral
```

## Components

### React clients

One SPA serves web, PWA, Android, and desktop.

- [React SPA entry](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/main.jsx): React/Vite · `frontend/src/main.jsx`
- [Application shell](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/App.jsx): React app · Composes cross-role entry and navigation flows. · `frontend/src/App.jsx`
- [Protected routes](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/routes/ProtectedRoute.jsx): route guard · Gates client navigation; API remains authoritative. · `frontend/src/routes/ProtectedRoute.jsx`
- [Role portals](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/pages/Admin/AdminLayout.jsx): Admin / Faculty / Student UI · Role-specific dashboards and workflows. · `frontend/src/pages/Admin/AdminLayout.jsx`
- [API client](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/utils/api.js): frontend HTTP client · `frontend/src/utils/api.js`
- [Marksheet & verification UI](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/src/pages/Admin/PrintMarksheet.jsx): React pages · Generates SHA-256 verification data and QR links. · `frontend/src/pages/Admin/PrintMarksheet.jsx`

### Express API

REST API and server-side authorization boundary.

- [Express server](https://github.com/ayusmannanda/college-management-system/blob/main/backend/server.js): Node.js runtime · `backend/server.js`
- [Express application](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/app.js): API composition · Mounts domain routes and middleware. · `backend/src/app.js`
- [Authentication API](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/routes/authRoutes.js): routes + controller · Credentials and Google OAuth completion. · `backend/src/routes/authRoutes.js`
- [JWT & role authorization](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/middleware/authMiddleware.js): Express middleware · Enforces Admin, Faculty, and Student privileges. · `backend/src/middleware/authMiddleware.js`
- [Academic master data](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/courseController.js): controllers · Manages courses, subjects, accounts, and faculty assignments. · `backend/src/controllers/courseController.js`
- [Attendance & marks API](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/attendanceController.js): controllers · Captures scoped records and serves reports and student views. · `backend/src/controllers/attendanceController.js`
- [Marksheet verification API](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/controllers/verifyController.js): controller · Resolves marksheet authenticity data. · `backend/src/controllers/verifyController.js`

### Academic data

Relational records and managed file assets.

- [MySQL connection](https://github.com/ayusmannanda/college-management-system/blob/main/backend/src/config/db.js): persistence adapter · `backend/src/config/db.js`
- [Academic schema](https://github.com/ayusmannanda/college-management-system/blob/main/sql/schema.sql): MySQL schema · Defines academic entities, records, results, and roll generation. · `sql/schema.sql`
- [Managed uploads](https://github.com/ayusmannanda/college-management-system/tree/main/backend/uploads): file assets · Profile photos and institutional marksheet assets. · `backend/uploads`

### Packaging & delivery

- [Android package](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/capacitor.config.json): Capacitor runtime · `frontend/capacitor.config.json`
- [Desktop package](https://github.com/ayusmannanda/college-management-system/blob/main/frontend/electron/main.js): Electron main process · `frontend/electron/main.js`
- [Build pipeline](https://github.com/ayusmannanda/college-management-system/blob/main/.github/workflows/build.yml): GitHub Actions · Builds delivery artifacts. · `.github/workflows/build.yml`

### Other components

- **Google OAuth**: external identity

## Connections

- React SPA entry → Application shell: mounts
- Application shell → Protected routes: uses
- Protected routes → Role portals: admits role views
- Role portals → API client: calls
- Marksheet & verification UI → API client: verifies through
- API client → Express server: REST
- Express server → Express application: starts
- Express application → Authentication API: mounts
- Express application → JWT & role authorization: applies
- JWT & role authorization → Academic master data: protects
- JWT & role authorization → Attendance & marks API: protects
- JWT & role authorization → Marksheet verification API: protects
- Authentication API → Google OAuth: OAuth
- Academic master data → MySQL connection: reads and writes
- Attendance & marks API → MySQL connection: reads and writes
- Marksheet verification API → MySQL connection: resolves
- MySQL connection → Academic schema: implements
- Academic master data → Managed uploads: manages assets
- React SPA entry → Android package: packaged as
- React SPA entry → Desktop package: wrapped by
- Build pipeline → React SPA entry: builds
- Build pipeline → Express server: builds
