# preetambara/spms architecture

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

- Interactive diagram: https://gitdiagram.com/preetambara/spms
- Repository: https://github.com/preetambara/spms

## Overview

SPMS is a role-based academic management web client for students, faculty, and administrators. Users enter through login, authenticated routes select their portal, and portal views present academic records and management workflows. The main domains cover student courses, attendance, assignments, exams and results; faculty class operations, grading and performance; and administration of people, subjects and notices. Services and browser storage provide an internal integration layer. The sampled code confirms routing, authentication and API-client behavior; many portal views and service implementations were not sampled, so those links are documented or omitted accordingly.

Main entry points: [`src/services/apiClient.js`](https://github.com/preetambara/spms/blob/main/src/services/apiClient.js) (HTTP client), [`src/routes/AppRoutes.jsx`](https://github.com/preetambara/spms/blob/main/src/routes/AppRoutes.jsx) (Role routes), [`src/services/authService.js`](https://github.com/preetambara/spms/blob/main/src/services/authService.js) (Auth service), [`src/App.jsx`](https://github.com/preetambara/spms/blob/main/src/App.jsx) (App providers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["App providers<br/>[App.jsx]"]
  node_routing["Role routes<br/>[AppRoutes.jsx]"]
  node_guard["Access guard<br/>[ProtectedRoute.jsx]"]
end

subgraph group_identity["Identity and state"]
  node_login["Login<br/>[Login.jsx]"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_noticecontext["Notice state<br/>[NoticesContext.jsx]"]
end

subgraph group_academic["Academic portals"]
  node_student["Student portal"]
  node_faculty["Faculty portal"]
  node_admin["Admin console"]
  node_notices["Notice board<br/>[NoticeBoard.jsx]"]
end

subgraph group_integration["Data and services"]
  node_authservice["Auth service<br/>[authService.js]"]
  node_adminservice["Admin services<br/>[adminService.js]"]
  node_facultyservice["Faculty services<br/>[facultyService.js]"]
  node_studentservice["Student services<br/>[studentService.js]"]
  node_noticeservice["Notice service<br/>[noticeService.js]"]
  node_apiclient["HTTP client<br/>[apiClient.js]"]
  node_mockdata["Demo academic data<br/>[mockData.js]"]
  node_storage["Browser storage wrapper<br/>[storage.js]"]
  node_endpoints["API endpoint map<br/>[apiEndpoints.js]"]
  node_keys["Storage keys<br/>[storageKeys.js]"]
end

node_users(("Students, faculty, admins"))
node_backend{{"REST backend"}}
node_localstore[("Local storage")]

node_users -->|"use portal"| node_app
node_app -->|"provides"| node_auth
node_app -->|"provides"| node_noticecontext
node_app -->|"renders"| node_routing
node_routing -->|"routes to"| node_login
node_routing -->|"protects routes"| node_guard
node_routing -->|"routes to"| node_student
node_routing -->|"routes to"| node_faculty
node_routing -->|"routes to"| node_admin
node_routing -->|"routes to"| node_notices
node_login -->|"requests login"| node_auth
node_auth -->|"calls"| node_authservice
node_authservice -->|"posts login"| node_apiclient
node_authservice -->|"uses"| node_endpoints
node_authservice -->|"reads and writes"| node_storage
node_guard -->|"checks identity"| node_auth
node_noticecontext -->|"loads notices"| node_noticeservice
node_studentservice -->|"calls"| node_apiclient
node_facultyservice -->|"calls"| node_apiclient
node_adminservice -.->|"uses"| node_apiclient
node_noticeservice -->|"calls"| node_apiclient
node_apiclient -->|"sends requests"| node_backend
node_apiclient -->|"reads token"| node_storage
node_apiclient -->|"uses"| node_keys
node_authservice -.->|"offline fallback"| node_mockdata
node_facultyservice -->|"uses fallback data"| node_mockdata
node_studentservice -->|"uses fallback data"| node_mockdata
node_noticeservice -->|"uses fallback data"| node_mockdata
node_storage -->|"reads and writes"| node_localstore
node_storage -.->|"uses"| node_keys

click node_app "https://github.com/preetambara/spms/blob/main/src/App.jsx"
click node_routing "https://github.com/preetambara/spms/blob/main/src/routes/AppRoutes.jsx"
click node_guard "https://github.com/preetambara/spms/blob/main/src/routes/ProtectedRoute.jsx"
click node_login "https://github.com/preetambara/spms/blob/main/src/pages/Login.jsx"
click node_auth "https://github.com/preetambara/spms/blob/main/src/context/AuthContext.jsx"
click node_authservice "https://github.com/preetambara/spms/blob/main/src/services/authService.js"
click node_student "https://github.com/preetambara/spms/tree/main/src/pages/student"
click node_faculty "https://github.com/preetambara/spms/tree/main/src/pages/faculty"
click node_admin "https://github.com/preetambara/spms/tree/main/src/pages/admin"
click node_notices "https://github.com/preetambara/spms/blob/main/src/pages/shared/NoticeBoard.jsx"
click node_noticecontext "https://github.com/preetambara/spms/blob/main/src/context/NoticesContext.jsx"
click node_adminservice "https://github.com/preetambara/spms/blob/main/src/services/adminService.js"
click node_facultyservice "https://github.com/preetambara/spms/blob/main/src/services/facultyService.js"
click node_studentservice "https://github.com/preetambara/spms/blob/main/src/services/studentService.js"
click node_noticeservice "https://github.com/preetambara/spms/blob/main/src/services/noticeService.js"
click node_apiclient "https://github.com/preetambara/spms/blob/main/src/services/apiClient.js"
click node_mockdata "https://github.com/preetambara/spms/blob/main/src/data/mockData.js"
click node_storage "https://github.com/preetambara/spms/blob/main/src/utils/storage.js"
click node_endpoints "https://github.com/preetambara/spms/blob/main/src/constants/apiEndpoints.js"
click node_keys "https://github.com/preetambara/spms/blob/main/src/constants/storageKeys.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_routing,node_guard toneBlue
class node_login,node_auth,node_noticecontext,node_localstore toneAmber
class node_student,node_faculty,node_admin,node_notices toneMint
class node_authservice,node_adminservice,node_facultyservice,node_studentservice,node_noticeservice,node_apiclient,node_mockdata,node_storage,node_endpoints,node_keys toneRose
class node_users,node_backend toneIndigo
```

## Components

### Application entry

- [App providers](https://github.com/preetambara/spms/blob/main/src/App.jsx): `src/App.jsx`
- [Role routes](https://github.com/preetambara/spms/blob/main/src/routes/AppRoutes.jsx): `src/routes/AppRoutes.jsx`
- [Access guard](https://github.com/preetambara/spms/blob/main/src/routes/ProtectedRoute.jsx): `src/routes/ProtectedRoute.jsx`

### Identity and state

- [Login](https://github.com/preetambara/spms/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Authentication state](https://github.com/preetambara/spms/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Notice state](https://github.com/preetambara/spms/blob/main/src/context/NoticesContext.jsx): `src/context/NoticesContext.jsx`

### Academic portals

- [Student portal](https://github.com/preetambara/spms/tree/main/src/pages/student): `src/pages/student`
- [Faculty portal](https://github.com/preetambara/spms/tree/main/src/pages/faculty): `src/pages/faculty`
- [Admin console](https://github.com/preetambara/spms/tree/main/src/pages/admin): `src/pages/admin`
- [Notice board](https://github.com/preetambara/spms/blob/main/src/pages/shared/NoticeBoard.jsx): `src/pages/shared/NoticeBoard.jsx`

### Data and services

- [Auth service](https://github.com/preetambara/spms/blob/main/src/services/authService.js): `src/services/authService.js`
- [Admin services](https://github.com/preetambara/spms/blob/main/src/services/adminService.js): `src/services/adminService.js`
- [Faculty services](https://github.com/preetambara/spms/blob/main/src/services/facultyService.js): `src/services/facultyService.js`
- [Student services](https://github.com/preetambara/spms/blob/main/src/services/studentService.js): `src/services/studentService.js`
- [Notice service](https://github.com/preetambara/spms/blob/main/src/services/noticeService.js): `src/services/noticeService.js`
- [HTTP client](https://github.com/preetambara/spms/blob/main/src/services/apiClient.js): `src/services/apiClient.js`
- [Demo academic data](https://github.com/preetambara/spms/blob/main/src/data/mockData.js): `src/data/mockData.js`
- [Browser storage wrapper](https://github.com/preetambara/spms/blob/main/src/utils/storage.js): `src/utils/storage.js`
- [API endpoint map](https://github.com/preetambara/spms/blob/main/src/constants/apiEndpoints.js): `src/constants/apiEndpoints.js`
- [Storage keys](https://github.com/preetambara/spms/blob/main/src/constants/storageKeys.js): `src/constants/storageKeys.js`

### Other components

- **Students, faculty, admins**
- **REST backend**
- **Local storage**

## Connections

- Students, faculty, admins → App providers: use portal
- App providers → Authentication state: provides (evidence: `src/App.jsx`)
- App providers → Notice state: provides (evidence: `src/App.jsx`)
- App providers → Role routes: renders (evidence: `src/App.jsx`)
- Role routes → Login: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Role routes → Access guard: protects routes (evidence: `src/routes/AppRoutes.jsx`)
- Role routes → Student portal: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Role routes → Faculty portal: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Role routes → Admin console: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Role routes → Notice board: routes to (evidence: `src/routes/AppRoutes.jsx`)
- Login → Authentication state: requests login (evidence: `src/pages/Login.jsx`)
- Authentication state → Auth service: calls (evidence: `src/context/AuthContext.jsx`)
- Auth service → HTTP client: posts login (evidence: `src/services/authService.js`)
- Auth service → API endpoint map: uses (evidence: `src/services/authService.js`)
- Auth service → Browser storage wrapper: reads and writes (evidence: `src/services/authService.js`)
- Access guard → Authentication state: checks identity (evidence: `src/routes/ProtectedRoute.jsx`)
- Notice state → Notice service: loads notices (evidence: `src/context/NoticesContext.jsx`)
- Student services → HTTP client: calls (evidence: `src/services/studentService.js`)
- Faculty services → HTTP client: calls (evidence: `src/services/facultyService.js`)
- Admin services → HTTP client: uses
- Notice service → HTTP client: calls (evidence: `src/services/noticeService.js`)
- HTTP client → REST backend: sends requests (evidence: `src/services/apiClient.js`)
- HTTP client → Browser storage wrapper: reads token (evidence: `src/services/apiClient.js`)
- HTTP client → Storage keys: uses (evidence: `src/services/apiClient.js`)
- Auth service → Demo academic data: offline fallback (evidence: `src/services/authService.js`)
- Faculty services → Demo academic data: uses fallback data (evidence: `src/services/facultyService.js`)
- Student services → Demo academic data: uses fallback data (evidence: `src/services/studentService.js`)
- Notice service → Demo academic data: uses fallback data (evidence: `src/services/noticeService.js`)
- Browser storage wrapper → Local storage: reads and writes (evidence: `src/utils/storage.js`)
- Browser storage wrapper → Storage keys: uses
