# spectropytechlab/learning-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/spectropytechlab/learning-management-system
- Repository: https://github.com/spectropytechlab/learning-management-system

## Overview

This is a React/TypeScript and Express learning-management system. The principal learner flow is entering a protected student area, accessing course content or exams, and receiving course progress or exam results; administrators and educators also manage courses, enrollment, questions, curriculum, and teaching sessions. The graph emphasizes the documented route/service structure and the sampled runtime calls. Several large feature services were not excerpted, so their internal links are omitted rather than inferred.

Main entry points: [`backend/server.js`](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/server.js) (Express API), [`frontend/src/app/routes/AppRoutes.tsx`](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/app/routes/AppRoutes.tsx) (Protected routes), [`frontend/src/App.tsx`](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/App.tsx) (Web application), [`backend/routes/enrollment.routes.js`](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/routes/enrollment.routes.js) (Enrollment routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Learner and staff app"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_authroutes["Protected routes<br/>[AppRoutes.tsx]"]
  node_studentcourse["Student course view"]
  node_examui["Exam runtime<br/>[useExamRuntime.ts]"]
  node_courseadmin["Course authoring"]
  node_questionui["Question bank"]
  node_sessionui["Teaching sessions UI"]
end

subgraph group_api["API and access"]
  node_server["Express API<br/>[server.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_enrollmentroutes["Enrollment routes"]
  node_dbrepo["Database access<br/>[db.repository.js]"]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_supabase["Supabase services<br/>[supabaseClient.js]"]
end

subgraph group_learning["Learning content"]
  node_enrollment["Enrollment service"]
  node_coursecontent["Course content"]
  node_curriculum["Curriculum"]
end

subgraph group_assessment["Assessment"]
  node_questions["Question services"]
  node_exams["Exam services<br/>[exams.service.js]"]
end

subgraph group_operations["Platform operations"]
  node_teachingroutes["Teaching-session routes"]
  node_teachingsessions["Teaching sessions"]
  node_hierarchy["Organization hierarchy"]
  node_entitlements["Module entitlements"]
end

node_learner(("Learner"))
node_educator(("Educator"))
node_admin(("Administrator"))

node_learner -.->|"uses"| node_webapp
node_educator -.->|"uses"| node_webapp
node_admin -.->|"uses"| node_webapp
node_webapp -->|"renders routes"| node_authroutes
node_authroutes -->|"routes to"| node_studentcourse
node_authroutes -.->|"routes to"| node_examui
node_authroutes -->|"routes to"| node_courseadmin
node_authroutes -->|"routes to"| node_questionui
node_authroutes -.->|"routes to"| node_sessionui
node_authroutes -.->|"requests API"| node_server
node_server -->|"mounts routes"| node_enrollmentroutes
node_enrollmentroutes -->|"authenticates"| node_auth
node_enrollmentroutes -->|"dispatches to"| node_enrollment
node_enrollment -->|"uses content service"| node_coursecontent
node_enrollment -->|"queries"| node_dbrepo
node_dbrepo -->|"queries"| node_database
node_server -->|"mounts routes"| node_teachingroutes
node_teachingroutes -->|"authenticates"| node_auth
node_teachingroutes -->|"dispatches to"| node_teachingsessions
node_teachingsessions -->|"reads and writes"| node_dbrepo
node_teachingsessions -->|"uses storage"| node_supabase
node_server -.->|"serves curriculum routes"| node_curriculum
node_server -.->|"serves exam routes"| node_exams
node_server -.->|"serves question routes"| node_questions
node_server -.->|"serves organization routes"| node_hierarchy
node_server -.->|"uses access middleware"| node_entitlements

click node_webapp "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/App.tsx"
click node_authroutes "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/app/routes/AppRoutes.tsx"
click node_studentcourse "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/pages/course/student/StudentCourseView.tsx"
click node_examui "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/exam-runtime/useExamRuntime.ts"
click node_courseadmin "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/courses/components/editor/CourseContentManager.tsx"
click node_questionui "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/question-bank/components/QuestionBankShell.tsx"
click node_sessionui "https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/pages/teaching-sessions/TeachingSessionsListPage.tsx"
click node_server "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/server.js"
click node_auth "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/middleware/auth.js"
click node_enrollmentroutes "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/routes/enrollment.routes.js"
click node_enrollment "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/enrollment.service.js"
click node_coursecontent "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/clientContent.service.js"
click node_curriculum "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/curriculum.service.js"
click node_questions "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/questions.service.js"
click node_exams "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/exams.service.js"
click node_teachingroutes "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/routes/teachingSessions.routes.js"
click node_teachingsessions "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/teachingSessions.service.js"
click node_hierarchy "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/hierarchy.service.js"
click node_entitlements "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/middleware/moduleEntitlements.js"
click node_dbrepo "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/repositories/db.repository.js"
click node_database "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/config/db.js"
click node_supabase "https://github.com/spectropytechlab/learning-management-system/blob/main/backend/config/supabaseClient.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_webapp,node_authroutes,node_studentcourse,node_examui,node_courseadmin,node_questionui,node_sessionui toneBlue
class node_server,node_auth,node_enrollmentroutes,node_dbrepo,node_database,node_supabase toneAmber
class node_enrollment,node_coursecontent,node_curriculum toneMint
class node_questions,node_exams toneRose
class node_teachingroutes,node_teachingsessions,node_hierarchy,node_entitlements,node_learner,node_educator,node_admin toneIndigo
```

## Components

### Learner and staff app

- [Web application](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Protected routes](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/app/routes/AppRoutes.tsx): `frontend/src/app/routes/AppRoutes.tsx`
- [Student course view](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/pages/course/student/StudentCourseView.tsx): `frontend/src/pages/course/student/StudentCourseView.tsx`
- [Exam runtime](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/exam-runtime/useExamRuntime.ts): `frontend/src/features/exam-runtime/useExamRuntime.ts`
- [Course authoring](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/courses/components/editor/CourseContentManager.tsx): `frontend/src/features/courses/components/editor/CourseContentManager.tsx`
- [Question bank](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/features/question-bank/components/QuestionBankShell.tsx): `frontend/src/features/question-bank/components/QuestionBankShell.tsx`
- [Teaching sessions UI](https://github.com/spectropytechlab/learning-management-system/blob/main/frontend/src/pages/teaching-sessions/TeachingSessionsListPage.tsx): `frontend/src/pages/teaching-sessions/TeachingSessionsListPage.tsx`

### API and access

- [Express API](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Enrollment routes](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/routes/enrollment.routes.js): `backend/routes/enrollment.routes.js`
- [Database access](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/repositories/db.repository.js): `backend/repositories/db.repository.js`
- [PostgreSQL](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/config/db.js): `backend/config/db.js`
- [Supabase services](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/config/supabaseClient.js): `backend/config/supabaseClient.js`

### Learning content

- [Enrollment service](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/enrollment.service.js): `backend/services/enrollment.service.js`
- [Course content](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/clientContent.service.js): `backend/services/clientContent.service.js`
- [Curriculum](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/curriculum.service.js): `backend/services/curriculum.service.js`

### Assessment

- [Question services](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/questions.service.js): `backend/services/questions.service.js`
- [Exam services](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/exams.service.js): `backend/services/exams.service.js`

### Platform operations

- [Teaching-session routes](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/routes/teachingSessions.routes.js): `backend/routes/teachingSessions.routes.js`
- [Teaching sessions](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/teachingSessions.service.js): `backend/services/teachingSessions.service.js`
- [Organization hierarchy](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/services/hierarchy.service.js): `backend/services/hierarchy.service.js`
- [Module entitlements](https://github.com/spectropytechlab/learning-management-system/blob/main/backend/middleware/moduleEntitlements.js): `backend/middleware/moduleEntitlements.js`

### Other components

- **Learner**
- **Educator**
- **Administrator**

## Connections

- Learner → Web application: uses
- Educator → Web application: uses
- Administrator → Web application: uses
- Web application → Protected routes: renders routes (evidence: `frontend/src/App.tsx`)
- Protected routes → Student course view: routes to (evidence: `frontend/src/app/routes/AppRoutes.tsx`)
- Protected routes → Exam runtime: routes to
- Protected routes → Course authoring: routes to (evidence: `frontend/src/app/routes/AppRoutes.tsx`)
- Protected routes → Question bank: routes to (evidence: `frontend/src/app/routes/AppRoutes.tsx`)
- Protected routes → Teaching sessions UI: routes to
- Protected routes → Express API: requests API
- Express API → Enrollment routes: mounts routes (evidence: `backend/server.js`)
- Enrollment routes → Authentication: authenticates (evidence: `backend/routes/enrollment.routes.js`)
- Enrollment routes → Enrollment service: dispatches to (evidence: `backend/routes/enrollment.routes.js`)
- Enrollment service → Course content: uses content service (evidence: `backend/services/enrollment.service.js`)
- Enrollment service → Database access: queries (evidence: `backend/services/enrollment.service.js`)
- Database access → PostgreSQL: queries (evidence: `backend/repositories/db.repository.js`)
- Express API → Teaching-session routes: mounts routes (evidence: `backend/server.js`)
- Teaching-session routes → Authentication: authenticates (evidence: `backend/routes/teachingSessions.routes.js`)
- Teaching-session routes → Teaching sessions: dispatches to (evidence: `backend/routes/teachingSessions.routes.js`)
- Teaching sessions → Database access: reads and writes (evidence: `backend/services/teachingSessions.service.js`)
- Teaching sessions → Supabase services: uses storage (evidence: `backend/services/teachingSessions.service.js`)
- Express API → Curriculum: serves curriculum routes
- Express API → Exam services: serves exam routes
- Express API → Question services: serves question routes
- Express API → Organization hierarchy: serves organization routes
- Express API → Module entitlements: uses access middleware
