# thanuk-sys/smart-student-portal-mern architecture

> Architecture diagram of the GitHub repository thanuk-sys/smart-student-portal-mern, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thanuk-sys/smart-student-portal-mern
- Repository: https://github.com/thanuk-sys/smart-student-portal-mern

## Overview

Smart Student Portal is a role-based student information portal: students and administrators sign in, then view or manage academic and campus information. The client routes authenticated users into portal pages and uses a shared state layer; the API authenticates requests and serves snapshots or administrative operations backed by MongoDB. Admins can manage students, marks, subjects, timetables, and uploaded documents; students can view their portal and update permitted profile data. The graph follows documented routes and sampled imports/calls; unsampled page-to-data details are not inferred.

Main entry points: [`client/src/App.jsx`](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/App.jsx) (Route application), [`server/src/index.js`](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/index.js) (Express application), [`server/src/routes/admin.js`](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/admin.js) (Admin operations), [`server/src/auth.js`](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/auth.js) (JWT and guards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Portal client"]
  node_app["Route application<br/>[App.jsx]"]
  node_login["Sign-in page<br/>[login.jsx]"]
  node_shell["Portal shell<br/>[AppShell.jsx]"]
  node_search["Global search<br/>[GlobalSearch.jsx]"]
  node_dashboard["Dashboard<br/>[dashboard.jsx]"]
  node_students["Student records<br/>[students.jsx]"]
  node_marks["Marks and results<br/>[marks.jsx]"]
  node_timetable["Timetable<br/>[timetable.jsx]"]
  node_syllabus["Syllabus<br/>[syllabus.jsx]"]
  node_library["Library<br/>[library.jsx]"]
  node_notices["Notices<br/>[notices.jsx]"]
  node_profile["Profile<br/>[profile.jsx]"]
end

subgraph group_auth["Authentication"]
  node_authroutes["Login and session<br/>[auth.js]"]
  node_tokens["JWT and guards<br/>[auth.js]"]
end

subgraph group_api["Portal API"]
  node_clientapi["API client<br/>[api.js]"]
  node_server["Express application<br/>[index.js]"]
end

subgraph group_domain["Academic services"]
  node_snapshot["Portal snapshot<br/>[state.js]"]
  node_admin["Admin operations<br/>[admin.js]"]
  node_seed["Demo data<br/>[seed.js]"]
end

subgraph group_storage["Persistence"]
  node_models["Domain models<br/>[models.js]"]
  node_database[("MongoDB connection<br/>[db.js]")]
  node_filedisk[("Uploaded files")]
end

node_user(("Student or admin"))
node_mongo[("MongoDB")]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_students
node_app -->|"routes to"| node_marks
node_app -->|"routes to"| node_timetable
node_app -->|"routes to"| node_syllabus
node_app -->|"routes to"| node_library
node_app -->|"routes to"| node_notices
node_app -->|"routes to"| node_profile
node_app -->|"renders"| node_shell
node_shell -->|"renders"| node_search
node_clientapi -->|"calls API"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_snapshot
node_server -->|"mounts"| node_admin
node_authroutes -->|"verifies and signs"| node_tokens
node_authroutes -->|"queries"| node_models
node_snapshot -->|"guards routes"| node_tokens
node_snapshot -->|"reads and writes"| node_models
node_admin -->|"guards routes"| node_tokens
node_admin -->|"manages records"| node_models
node_server -->|"connects"| node_database
node_database -->|"opens connection"| node_mongo
node_server -->|"seeds if empty"| node_seed
node_seed -->|"populates"| node_models
node_seed -->|"hashes passwords"| node_tokens
node_server -->|"serves uploads"| node_filedisk
node_admin -->|"stores and removes files"| node_filedisk

click node_app "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/App.jsx"
click node_login "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/login.jsx"
click node_shell "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/components/portal/AppShell.jsx"
click node_search "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/components/portal/GlobalSearch.jsx"
click node_dashboard "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/dashboard.jsx"
click node_students "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/students.jsx"
click node_marks "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/marks.jsx"
click node_timetable "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/timetable.jsx"
click node_syllabus "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/syllabus.jsx"
click node_library "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/library.jsx"
click node_notices "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/notices.jsx"
click node_profile "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/profile.jsx"
click node_clientapi "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/lib/api.js"
click node_server "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/index.js"
click node_authroutes "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/auth.js"
click node_tokens "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/auth.js"
click node_snapshot "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/state.js"
click node_admin "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/admin.js"
click node_seed "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/seed.js"
click node_models "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/models.js"
click node_database "https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/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_app,node_login,node_shell,node_search,node_dashboard,node_students,node_marks,node_timetable,node_syllabus,node_library,node_notices,node_profile toneBlue
class node_authroutes,node_tokens,node_mongo toneAmber
class node_clientapi,node_server toneMint
class node_snapshot,node_admin,node_seed toneRose
class node_models,node_database,node_filedisk,node_user toneIndigo
```

## Components

### Portal client

- [Route application](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign-in page](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/login.jsx): `client/src/pages/login.jsx`
- [Portal shell](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/components/portal/AppShell.jsx): `client/src/components/portal/AppShell.jsx`
- [Global search](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/components/portal/GlobalSearch.jsx): `client/src/components/portal/GlobalSearch.jsx`
- [Dashboard](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/dashboard.jsx): `client/src/pages/dashboard.jsx`
- [Student records](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/students.jsx): `client/src/pages/students.jsx`
- [Marks and results](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/marks.jsx): `client/src/pages/marks.jsx`
- [Timetable](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/timetable.jsx): `client/src/pages/timetable.jsx`
- [Syllabus](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/syllabus.jsx): `client/src/pages/syllabus.jsx`
- [Library](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/library.jsx): `client/src/pages/library.jsx`
- [Notices](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/notices.jsx): `client/src/pages/notices.jsx`
- [Profile](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/pages/profile.jsx): `client/src/pages/profile.jsx`

### Authentication

- [Login and session](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/auth.js): `server/src/routes/auth.js`
- [JWT and guards](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/auth.js): `server/src/auth.js`

### Portal API

- [API client](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/client/src/lib/api.js): `client/src/lib/api.js`
- [Express application](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/index.js): `server/src/index.js`

### Academic services

- [Portal snapshot](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/state.js): `server/src/routes/state.js`
- [Admin operations](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/routes/admin.js): `server/src/routes/admin.js`
- [Demo data](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/seed.js): `server/src/seed.js`

### Persistence

- [Domain models](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/models.js): `server/src/models.js`
- [MongoDB connection](https://github.com/thanuk-sys/smart-student-portal-mern/blob/main/server/src/db.js): `server/src/db.js`
- **Uploaded files**

### Other components

- **Student or admin**
- **MongoDB**

## Connections

- Student or admin → Route application: uses
- Route application → Sign-in page: routes to (evidence: `client/src/App.jsx`)
- Route application → Dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Student records: routes to (evidence: `client/src/App.jsx`)
- Route application → Marks and results: routes to (evidence: `client/src/App.jsx`)
- Route application → Timetable: routes to (evidence: `client/src/App.jsx`)
- Route application → Syllabus: routes to (evidence: `client/src/App.jsx`)
- Route application → Library: routes to (evidence: `client/src/App.jsx`)
- Route application → Notices: routes to (evidence: `client/src/App.jsx`)
- Route application → Profile: routes to (evidence: `client/src/App.jsx`)
- Route application → Portal shell: renders (evidence: `client/src/App.jsx`)
- Portal shell → Global search: renders (evidence: `client/src/components/portal/AppShell.jsx`)
- API client → Express application: calls API
- Express application → Login and session: mounts (evidence: `server/src/index.js`)
- Express application → Portal snapshot: mounts (evidence: `server/src/index.js`)
- Express application → Admin operations: mounts (evidence: `server/src/index.js`)
- Login and session → JWT and guards: verifies and signs (evidence: `server/src/routes/auth.js`)
- Login and session → Domain models: queries (evidence: `server/src/routes/auth.js`)
- Portal snapshot → JWT and guards: guards routes (evidence: `server/src/routes/state.js`)
- Portal snapshot → Domain models: reads and writes (evidence: `server/src/routes/state.js`)
- Admin operations → JWT and guards: guards routes (evidence: `server/src/routes/admin.js`)
- Admin operations → Domain models: manages records (evidence: `server/src/routes/admin.js`)
- Express application → MongoDB connection: connects (evidence: `server/src/index.js`)
- MongoDB connection → MongoDB: opens connection
- Express application → Demo data: seeds if empty (evidence: `server/src/index.js`)
- Demo data → Domain models: populates (evidence: `server/src/seed.js`)
- Demo data → JWT and guards: hashes passwords (evidence: `server/src/seed.js`)
- Express application → Uploaded files: serves uploads (evidence: `server/src/index.js`)
- Admin operations → Uploaded files: stores and removes files
