# codingwithkunal/course_management_system architecture

> Architecture diagram of the GitHub repository codingwithkunal/course_management_system, 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/codingwithkunal/course_management_system
- Repository: https://github.com/codingwithkunal/course_management_system

## Overview

Learnify is a course-learning platform for students, instructors, and administrators. Its main journey is course discovery, checkout/enrollment, and learning with saved progress; instructors create and resubmit courses, while admins review and publish courses and manage users. The frontend routes role-specific experiences through service calls to an Express API; API handlers use MongoDB models, with Stripe and email as external integrations. Connections below follow sampled routing, calls, or explicit API paths; unsampled capabilities are represented at their source directories where appropriate.

Main entry points: [`cms-frontend/src/routes/AppRoutes.jsx`](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/routes/AppRoutes.jsx) (Role-based routes), [`Server/src/controller/admin.controller.js`](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/admin.controller.js) (Moderation and reports), [`cms-frontend/src/services/api.js`](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/services/api.js) (API client), [`Server/src/controller/payment.controller.js`](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/payment.controller.js) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Learner and Staff App"]
  node_routes["Role-based routes<br/>[AppRoutes.jsx]"]
  node_catalog["Course discovery"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_learning_ui["Learning experience<br/>[CourseLearn.jsx]"]
  node_enroll_hook["Progress hooks<br/>[useEnrollment.js]"]
  node_instructor_ui["Instructor workspace"]
  node_admin_ui["Admin workspace<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["API and Identity"]
  node_services["API client<br/>[api.js]"]
  node_enrollment_service["Enrollment service"]
  node_auth_routes["Identity routes<br/>[auth.router.js]"]
  node_auth_controller["Authentication<br/>[auth.controller.js]"]
  node_auth_guard["Access control<br/>[auth.middleware.js]"]
  node_course_routes["Course routes<br/>[course.routes.js]"]
  node_admin_routes["Admin routes<br/>[admin.routes.js]"]
  node_payment_routes["Payment routes<br/>[payment.routes.js]"]
end

subgraph group_learning["Course Lifecycle"]
  node_course_controller["Course operations"]
  node_progress_controller["Learning progress"]
  node_instructor_controller["Instructor operations"]
  node_admin_controller["Moderation and reports"]
  node_payment_controller["Payment processing"]
end

subgraph group_state["Platform Data"]
  node_user_store[("User records<br/>[user.js]")]
  node_course_store[("Course records<br/>[course.js]")]
  node_enrollment_store[("Enrollment and progress<br/>[enrollment.js]")]
  node_payment_store[("Payment records<br/>[payments.js]")]
  node_review_store[("Course reviews<br/>[review.js]")]
end

subgraph group_integrations["External Services"]
  node_stripe["Stripe"]
  node_email["Email delivery<br/>[sendEmail.js]"]
end

node_visitor(("Learner or staff"))

node_visitor -->|"opens app"| node_routes
node_routes -->|"routes to"| node_catalog
node_routes -->|"routes to"| node_checkout
node_routes -->|"routes to"| node_learning_ui
node_routes -->|"routes to"| node_instructor_ui
node_routes -->|"routes to"| node_admin_ui
node_learning_ui -->|"uses progress"| node_enroll_hook
node_enroll_hook -->|"fetches and saves"| node_enrollment_service
node_enrollment_service -->|"calls API"| node_services
node_services -.->|"HTTP requests"| node_course_routes
node_visitor -.->|"authenticates"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_store
node_auth_controller -->|"sends messages"| node_email
node_course_routes -->|"guards requests"| node_auth_guard
node_course_routes -->|"dispatches"| node_course_controller
node_course_routes -->|"dispatches"| node_progress_controller
node_course_controller -->|"reads and writes"| node_course_store
node_course_controller -->|"checks enrollment"| node_enrollment_store
node_course_controller -->|"checks reviews"| node_review_store
node_progress_controller -->|"tracks progress"| node_enrollment_store
node_progress_controller -->|"reads course"| node_course_store
node_visitor -.->|"administers"| node_admin_routes
node_admin_routes -->|"guards requests"| node_auth_guard
node_admin_routes -->|"dispatches"| node_admin_controller
node_admin_controller -->|"manages users"| node_user_store
node_admin_controller -->|"moderates courses"| node_course_store
node_admin_controller -->|"reports enrollments"| node_enrollment_store
node_admin_controller -->|"reports revenue"| node_payment_store
node_admin_controller -->|"reports reviews"| node_review_store
node_visitor -.->|"pays for course"| node_payment_routes
node_payment_routes -->|"guards requests"| node_auth_guard
node_payment_routes -->|"dispatches"| node_payment_controller
node_payment_controller -->|"charges and verifies"| node_stripe
node_payment_controller -->|"reads course"| node_course_store
node_payment_controller -->|"records access"| node_enrollment_store
node_payment_controller -->|"records payment"| node_payment_store
node_instructor_ui -.->|"uses API"| node_services
node_admin_ui -.->|"uses API"| node_services
node_catalog -.->|"uses API"| node_services
node_checkout -.->|"uses API"| node_services

click node_routes "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/routes/AppRoutes.jsx"
click node_catalog "https://github.com/codingwithkunal/course_management_system/tree/main/cms-frontend/src/pages/public"
click node_checkout "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/student/Checkout.jsx"
click node_learning_ui "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/student/CourseLearn.jsx"
click node_enroll_hook "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/hooks/useEnrollment.js"
click node_instructor_ui "https://github.com/codingwithkunal/course_management_system/tree/main/cms-frontend/src/pages/instructor"
click node_admin_ui "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/admin/AdminDashboard.jsx"
click node_services "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/services/api.js"
click node_enrollment_service "https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/services/enrollmentService.js"
click node_auth_routes "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/auth.router.js"
click node_auth_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/auth.controller.js"
click node_auth_guard "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/middleware/auth.middleware.js"
click node_course_routes "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/course.routes.js"
click node_course_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/course.controller.js"
click node_progress_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/courseProgress.Controller.js"
click node_instructor_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/instructor.controller.js"
click node_admin_routes "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/admin.routes.js"
click node_admin_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/admin.controller.js"
click node_payment_routes "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/payment.routes.js"
click node_payment_controller "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/payment.controller.js"
click node_user_store "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/user.js"
click node_course_store "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/course.js"
click node_enrollment_store "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/enrollment.js"
click node_payment_store "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/payments.js"
click node_review_store "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/review.js"
click node_email "https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/utils/sendEmail.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_routes,node_catalog,node_checkout,node_learning_ui,node_enroll_hook,node_instructor_ui,node_admin_ui toneBlue
class node_services,node_enrollment_service,node_auth_routes,node_auth_controller,node_auth_guard,node_course_routes,node_admin_routes,node_payment_routes toneAmber
class node_course_controller,node_progress_controller,node_instructor_controller,node_admin_controller,node_payment_controller toneMint
class node_user_store,node_course_store,node_enrollment_store,node_payment_store,node_review_store toneRose
class node_stripe,node_email,node_visitor toneIndigo
```

## Components

### Learner and Staff App

- [Role-based routes](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/routes/AppRoutes.jsx): `cms-frontend/src/routes/AppRoutes.jsx`
- [Course discovery](https://github.com/codingwithkunal/course_management_system/tree/main/cms-frontend/src/pages/public): `cms-frontend/src/pages/public`
- [Checkout](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/student/Checkout.jsx): `cms-frontend/src/pages/student/Checkout.jsx`
- [Learning experience](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/student/CourseLearn.jsx): `cms-frontend/src/pages/student/CourseLearn.jsx`
- [Progress hooks](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/hooks/useEnrollment.js): `cms-frontend/src/hooks/useEnrollment.js`
- [Instructor workspace](https://github.com/codingwithkunal/course_management_system/tree/main/cms-frontend/src/pages/instructor): `cms-frontend/src/pages/instructor`
- [Admin workspace](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/pages/admin/AdminDashboard.jsx): `cms-frontend/src/pages/admin/AdminDashboard.jsx`

### API and Identity

- [API client](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/services/api.js): `cms-frontend/src/services/api.js`
- [Enrollment service](https://github.com/codingwithkunal/course_management_system/blob/main/cms-frontend/src/services/enrollmentService.js): `cms-frontend/src/services/enrollmentService.js`
- [Identity routes](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/auth.router.js): `Server/src/routes/auth.router.js`
- [Authentication](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/auth.controller.js): `Server/src/controller/auth.controller.js`
- [Access control](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/middleware/auth.middleware.js): `Server/src/middleware/auth.middleware.js`
- [Course routes](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/course.routes.js): `Server/src/routes/course.routes.js`
- [Admin routes](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/admin.routes.js): `Server/src/routes/admin.routes.js`
- [Payment routes](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/routes/payment.routes.js): `Server/src/routes/payment.routes.js`

### Course Lifecycle

- [Course operations](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/course.controller.js): `Server/src/controller/course.controller.js`
- [Learning progress](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/courseProgress.Controller.js): `Server/src/controller/courseProgress.Controller.js`
- [Instructor operations](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/instructor.controller.js): `Server/src/controller/instructor.controller.js`
- [Moderation and reports](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/admin.controller.js): `Server/src/controller/admin.controller.js`
- [Payment processing](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/controller/payment.controller.js): `Server/src/controller/payment.controller.js`

### Platform Data

- [User records](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/user.js): `Server/src/models/user.js`
- [Course records](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/course.js): `Server/src/models/course.js`
- [Enrollment and progress](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/enrollment.js): `Server/src/models/enrollment.js`
- [Payment records](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/payments.js): `Server/src/models/payments.js`
- [Course reviews](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/models/review.js): `Server/src/models/review.js`

### External Services

- **Stripe**
- [Email delivery](https://github.com/codingwithkunal/course_management_system/blob/main/Server/src/utils/sendEmail.js): `Server/src/utils/sendEmail.js`

### Other components

- **Learner or staff**

## Connections

- Learner or staff → Role-based routes: opens app (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Course discovery: routes to (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Checkout: routes to (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Learning experience: routes to (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Instructor workspace: routes to (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Role-based routes → Admin workspace: routes to (evidence: `cms-frontend/src/routes/AppRoutes.jsx`)
- Learning experience → Progress hooks: uses progress (evidence: `cms-frontend/src/pages/student/CourseLearn.jsx`)
- Progress hooks → Enrollment service: fetches and saves (evidence: `cms-frontend/src/hooks/useEnrollment.js`)
- Enrollment service → API client: calls API (evidence: `cms-frontend/src/services/enrollmentService.js`)
- API client → Course routes: HTTP requests
- Learner or staff → Identity routes: authenticates
- Identity routes → Authentication: dispatches (evidence: `Server/src/routes/auth.router.js`)
- Authentication → User records: reads and writes (evidence: `Server/src/controller/auth.controller.js`)
- Authentication → Email delivery: sends messages (evidence: `Server/src/controller/auth.controller.js`)
- Course routes → Access control: guards requests (evidence: `Server/src/routes/course.routes.js`)
- Course routes → Course operations: dispatches (evidence: `Server/src/routes/course.routes.js`)
- Course routes → Learning progress: dispatches (evidence: `Server/src/routes/course.routes.js`)
- Course operations → Course records: reads and writes (evidence: `Server/src/controller/course.controller.js`)
- Course operations → Enrollment and progress: checks enrollment (evidence: `Server/src/controller/course.controller.js`)
- Course operations → Course reviews: checks reviews (evidence: `Server/src/controller/course.controller.js`)
- Learning progress → Enrollment and progress: tracks progress (evidence: `Server/src/controller/courseProgress.Controller.js`)
- Learning progress → Course records: reads course (evidence: `Server/src/controller/courseProgress.Controller.js`)
- Learner or staff → Admin routes: administers
- Admin routes → Access control: guards requests (evidence: `Server/src/routes/admin.routes.js`)
- Admin routes → Moderation and reports: dispatches (evidence: `Server/src/routes/admin.routes.js`)
- Moderation and reports → User records: manages users (evidence: `Server/src/controller/admin.controller.js`)
- Moderation and reports → Course records: moderates courses (evidence: `Server/src/controller/admin.controller.js`)
- Moderation and reports → Enrollment and progress: reports enrollments (evidence: `Server/src/controller/admin.controller.js`)
- Moderation and reports → Payment records: reports revenue (evidence: `Server/src/controller/admin.controller.js`)
- Moderation and reports → Course reviews: reports reviews (evidence: `Server/src/controller/admin.controller.js`)
- Learner or staff → Payment routes: pays for course
- Payment routes → Access control: guards requests (evidence: `Server/src/routes/payment.routes.js`)
- Payment routes → Payment processing: dispatches (evidence: `Server/src/routes/payment.routes.js`)
- Payment processing → Stripe: charges and verifies (evidence: `Server/src/controller/payment.controller.js`)
- Payment processing → Course records: reads course (evidence: `Server/src/controller/payment.controller.js`)
- Payment processing → Enrollment and progress: records access (evidence: `Server/src/controller/payment.controller.js`)
- Payment processing → Payment records: records payment (evidence: `Server/src/controller/payment.controller.js`)
- Instructor workspace → API client: uses API
- Admin workspace → API client: uses API
- Course discovery → API client: uses API
- Checkout → API client: uses API
