# rajiv-rago/lms architecture

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

- Interactive diagram: https://gitdiagram.com/rajiv-rago/lms
- Repository: https://github.com/rajiv-rago/lms

## Overview

Kantigo is a full-stack learning management system for teachers, students, and administrators. Its central workflow is that a teacher creates and publishes a course, builds modules and lessons, and adds assignments; students discover or enroll in courses, learn from lesson content, submit work or take quizzes, and track results. AI adds syllabus and lesson generation, learning resources, and an in-course tutor. The graph includes documented product capabilities and sampled internal layers; some page-to-API wiring and unsampled subsystems are shown only where the README supports the relationship.

Main entry points: [`app/api/courses/route.ts`](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/route.ts) (Course management), [`app/api/courses/[id]/enroll/route.ts`](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/enroll/route.ts) (Enrollment), [`app/api/notifications/route.ts`](https://github.com/rajiv-rago/lms/blob/main/app/api/notifications/route.ts) (Notifications), [`app/(auth)/login/page.tsx`](https://github.com/rajiv-rago/lms/blob/main/app/(auth)/login/page.tsx) (Sign in and register)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and discovery"]
  node_auth_ui["Sign in and register<br/>[page.tsx]"]
  node_auth_api["Authentication<br/>[route.ts]"]
  node_course_browse["Course catalog<br/>[page.tsx]"]
end

subgraph group_courses["Course learning"]
  node_course_api["Course management<br/>[route.ts]"]
  node_course_store[("Course records<br/>[Course.ts]")]
  node_course_learning["Course lessons<br/>[page.tsx]"]
  node_enrollment_api["Enrollment<br/>[route.ts]"]
  node_enrollment_store[("Enrollment records<br/>[Enrollment.ts]")]
end

subgraph group_assessment["Assessment"]
  node_assignment_api["Assignments and quizzes<br/>[route.ts]"]
  node_submission_api["Submissions<br/>[route.ts]"]
  node_gradebook["Gradebook<br/>[page.tsx]"]
end

subgraph group_ai["AI learning tools"]
  node_ai_course["AI course generation<br/>[route.ts]"]
  node_ai_content["AI content generation<br/>[route.ts]"]
  node_ai_chat["AI tutor chat<br/>[route.ts]"]
  node_ai_services["AI provider services<br/>[index.ts]"]
  node_research["Web research<br/>[webResearch.ts]"]
end

subgraph group_platform["Platform services"]
  node_notification_api["Notifications<br/>[route.ts]"]
  node_notification_store[("Notification records<br/>[Notification.ts]")]
end

node_learner(("Learner"))
node_teacher(("Teacher"))
node_admin(("Administrator"))
node_provider{{"AI providers"}}
node_database[("MongoDB")]

node_learner -->|"signs in"| node_auth_ui
node_teacher -->|"signs in"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_api
node_learner -->|"explores courses"| node_course_browse
node_course_browse -->|"lists courses"| node_course_api
node_teacher -->|"creates courses"| node_course_api
node_course_api -->|"reads and writes"| node_course_store
node_course_api -->|"connects to"| node_database
node_learner -->|"enrolls"| node_enrollment_api
node_enrollment_api -.->|"records enrollment"| node_enrollment_store
node_enrollment_api -.->|"connects to"| node_database
node_learner -->|"learns from lessons"| node_course_learning
node_teacher -->|"creates assignments"| node_assignment_api
node_learner -->|"takes quizzes"| node_assignment_api
node_learner -->|"submits work"| node_submission_api
node_submission_api -->|"tracks scores"| node_gradebook
node_teacher -->|"reviews grades"| node_gradebook
node_teacher -->|"generates syllabus"| node_ai_course
node_teacher -->|"generates lessons"| node_ai_content
node_learner -->|"asks tutor"| node_ai_chat
node_ai_content -->|"selects provider"| node_ai_services
node_ai_chat -->|"calls tutor"| node_ai_services
node_ai_services -->|"generates responses"| node_provider
node_ai_course -->|"adds course references"| node_research
node_learner -->|"views notifications"| node_notification_api
node_notification_api -->|"reads and updates"| node_notification_store
node_notification_api -->|"connects to"| node_database
node_admin -->|"moderates courses"| node_course_api

click node_auth_ui "https://github.com/rajiv-rago/lms/blob/main/app/(auth)/login/page.tsx"
click node_auth_api "https://github.com/rajiv-rago/lms/blob/main/app/api/auth/%5B...nextauth%5D/route.ts"
click node_course_browse "https://github.com/rajiv-rago/lms/blob/main/app/(public)/explore/page.tsx"
click node_course_api "https://github.com/rajiv-rago/lms/blob/main/app/api/courses/route.ts"
click node_course_store "https://github.com/rajiv-rago/lms/blob/main/lib/models/Course.ts"
click node_course_learning "https://github.com/rajiv-rago/lms/blob/main/app/(dashboard)/courses/%5Bid%5D/modules/%5BmoduleId%5D/lessons/%5BlessonId%5D/page.tsx"
click node_enrollment_api "https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/enroll/route.ts"
click node_enrollment_store "https://github.com/rajiv-rago/lms/blob/main/lib/models/Enrollment.ts"
click node_assignment_api "https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/assignments/route.ts"
click node_submission_api "https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/assignments/%5BassignmentId%5D/submissions/route.ts"
click node_gradebook "https://github.com/rajiv-rago/lms/blob/main/app/(dashboard)/courses/%5Bid%5D/gradebook/page.tsx"
click node_ai_course "https://github.com/rajiv-rago/lms/blob/main/app/api/courses/ai/syllabus/route.ts"
click node_ai_content "https://github.com/rajiv-rago/lms/blob/main/app/api/ai/generate/route.ts"
click node_ai_chat "https://github.com/rajiv-rago/lms/blob/main/app/api/ai/chat/route.ts"
click node_ai_services "https://github.com/rajiv-rago/lms/blob/main/lib/ai/index.ts"
click node_research "https://github.com/rajiv-rago/lms/blob/main/lib/ai/services/webResearch.ts"
click node_notification_api "https://github.com/rajiv-rago/lms/blob/main/app/api/notifications/route.ts"
click node_notification_store "https://github.com/rajiv-rago/lms/blob/main/lib/models/Notification.ts"

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_auth_ui,node_auth_api,node_course_browse toneBlue
class node_course_api,node_course_store,node_course_learning,node_enrollment_api,node_enrollment_store,node_database toneAmber
class node_assignment_api,node_submission_api,node_gradebook toneMint
class node_ai_course,node_ai_content,node_ai_chat,node_ai_services,node_research toneRose
class node_notification_api,node_notification_store,node_learner,node_teacher,node_admin,node_provider toneIndigo
```

## Components

### Access and discovery

- [Sign in and register](https://github.com/rajiv-rago/lms/blob/main/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Authentication](https://github.com/rajiv-rago/lms/blob/main/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`
- [Course catalog](https://github.com/rajiv-rago/lms/blob/main/app/(public)/explore/page.tsx): `app/(public)/explore/page.tsx`

### Course learning

- [Course management](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/route.ts): `app/api/courses/route.ts`
- [Course records](https://github.com/rajiv-rago/lms/blob/main/lib/models/Course.ts): `lib/models/Course.ts`
- [Course lessons](https://github.com/rajiv-rago/lms/blob/main/app/(dashboard)/courses/%5Bid%5D/modules/%5BmoduleId%5D/lessons/%5BlessonId%5D/page.tsx): `app/(dashboard)/courses/[id]/modules/[moduleId]/lessons/[lessonId]/page.tsx`
- [Enrollment](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/enroll/route.ts): `app/api/courses/[id]/enroll/route.ts`
- [Enrollment records](https://github.com/rajiv-rago/lms/blob/main/lib/models/Enrollment.ts): `lib/models/Enrollment.ts`

### Assessment

- [Assignments and quizzes](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/assignments/route.ts): `app/api/courses/[id]/assignments/route.ts`
- [Submissions](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/%5Bid%5D/assignments/%5BassignmentId%5D/submissions/route.ts): `app/api/courses/[id]/assignments/[assignmentId]/submissions/route.ts`
- [Gradebook](https://github.com/rajiv-rago/lms/blob/main/app/(dashboard)/courses/%5Bid%5D/gradebook/page.tsx): `app/(dashboard)/courses/[id]/gradebook/page.tsx`

### AI learning tools

- [AI course generation](https://github.com/rajiv-rago/lms/blob/main/app/api/courses/ai/syllabus/route.ts): `app/api/courses/ai/syllabus/route.ts`
- [AI content generation](https://github.com/rajiv-rago/lms/blob/main/app/api/ai/generate/route.ts): `app/api/ai/generate/route.ts`
- [AI tutor chat](https://github.com/rajiv-rago/lms/blob/main/app/api/ai/chat/route.ts): `app/api/ai/chat/route.ts`
- [AI provider services](https://github.com/rajiv-rago/lms/blob/main/lib/ai/index.ts): `lib/ai/index.ts`
- [Web research](https://github.com/rajiv-rago/lms/blob/main/lib/ai/services/webResearch.ts): `lib/ai/services/webResearch.ts`

### Platform services

- [Notifications](https://github.com/rajiv-rago/lms/blob/main/app/api/notifications/route.ts): `app/api/notifications/route.ts`
- [Notification records](https://github.com/rajiv-rago/lms/blob/main/lib/models/Notification.ts): `lib/models/Notification.ts`

### Other components

- **Learner**
- **Teacher**
- **Administrator**
- **AI providers**
- **MongoDB**

## Connections

- Learner → Sign in and register: signs in (evidence: `README.md`)
- Teacher → Sign in and register: signs in (evidence: `README.md`)
- Sign in and register → Authentication: authenticates (evidence: `README.md`)
- Learner → Course catalog: explores courses (evidence: `README.md`)
- Course catalog → Course management: lists courses (evidence: `README.md`)
- Teacher → Course management: creates courses (evidence: `README.md`)
- Course management → Course records: reads and writes (evidence: `app/api/courses/route.ts`)
- Course management → MongoDB: connects to (evidence: `app/api/courses/route.ts`)
- Learner → Enrollment: enrolls (evidence: `README.md`)
- Enrollment → Enrollment records: records enrollment
- Enrollment → MongoDB: connects to
- Learner → Course lessons: learns from lessons (evidence: `README.md`)
- Teacher → Assignments and quizzes: creates assignments (evidence: `README.md`)
- Learner → Assignments and quizzes: takes quizzes (evidence: `README.md`)
- Learner → Submissions: submits work (evidence: `README.md`)
- Submissions → Gradebook: tracks scores (evidence: `README.md`)
- Teacher → Gradebook: reviews grades (evidence: `README.md`)
- Teacher → AI course generation: generates syllabus (evidence: `README.md`)
- Teacher → AI content generation: generates lessons (evidence: `README.md`)
- Learner → AI tutor chat: asks tutor (evidence: `README.md`)
- AI content generation → AI provider services: selects provider (evidence: `app/api/ai/generate/route.ts`)
- AI tutor chat → AI provider services: calls tutor (evidence: `app/api/ai/chat/route.ts`)
- AI provider services → AI providers: generates responses (evidence: `lib/ai/index.ts`)
- AI course generation → Web research: adds course references (evidence: `README.md`)
- Learner → Notifications: views notifications (evidence: `README.md`)
- Notifications → Notification records: reads and updates (evidence: `app/api/notifications/route.ts`)
- Notifications → MongoDB: connects to (evidence: `app/api/notifications/route.ts`)
- Administrator → Course management: moderates courses (evidence: `README.md`)
