You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validation → Zod schema validation on request body
Service Layer → Business logic with enrollment checks, permission validation
Database Query → MongoDB operations via Mongoose ODM (.lean() for reads)
Response → Standardized JSON response via ApiResponse utility
UI Update → React components re-render with fresh data
🔌 API Endpoints
Base URL: /api
Users (/users)
Method
Endpoint
Description
Auth
POST
/users/sync
Sync/create user from Clerk
✅
GET
/users/profile
Get current user profile
✅
PUT
/users/profile
Update user profile
✅
Courses (/courses)
Method
Endpoint
Description
Auth
GET
/courses
Get all published courses
❌
GET
/courses/search?q=query
Search courses
❌
GET
/courses/:slug
Get course details by slug
❌
Enrollments (/enrollments)
Method
Endpoint
Description
Auth
GET
/enrollments/check/:courseId
Check enrollment status
✅
GET
/enrollments/my-courses
Get user's enrolled courses
✅
POST
/enrollments
Create enrollment (free courses)
✅
Lessons (/lessons)
Method
Endpoint
Description
Auth
GET
/lessons/:id/content
Get lesson content
✅
Progress (/progress)
Method
Endpoint
Description
Auth
POST
/progress/lesson/:lessonId/complete
Mark lesson as complete
✅
GET
/progress/course/:courseId
Get course progress
✅
GET
/progress/course/:courseId/detailed
Get detailed progress
✅
Quizzes (/quizzes)
Method
Endpoint
Description
Auth
GET
/quizzes/course/:courseId
Get quizzes for a course
✅
GET
/quizzes/:quizId/take
Get quiz for taking
✅
GET
/quizzes/:quizId/can-take
Check quiz eligibility
✅
POST
/quizzes/:quizId/submit
Submit quiz attempt
✅
GET
/quizzes/:quizId/attempts
Get attempt history
✅
Live Sessions (/live-sessions)
Method
Endpoint
Description
Auth
POST
/live-sessions/token
Generate Stream.io video token
✅
GET
/live-sessions/course/:courseIdOrSlug
List sessions for a course
✅
POST
/live-sessions
Create a session
✅ Mentor
POST
/live-sessions/:id/join
Join a session
✅
POST
/live-sessions/:id/start
Start a session
✅ Mentor
POST
/live-sessions/:id/end
End a session
✅ Mentor
Mentor (/mentor)
Method
Endpoint
Description
Auth
GET
/mentor/courses
Get mentor's own courses
✅ Mentor
POST
/mentor/courses
Create a new course
✅ Mentor
PUT
/mentor/courses/:id
Update mentor's course
✅ Mentor
POST
/mentor/courses/:courseId/chapters
Create chapter
✅ Mentor
POST
/mentor/courses/:courseId/lessons
Create lesson
✅ Mentor
POST
/mentor/courses/:courseId/quizzes
Create quiz
✅ Mentor
Admin (/admin)
Method
Endpoint
Description
Auth
GET
/admin/users
Get all users
✅ Admin
PUT
/admin/users/:userId/role
Update user role
✅ Admin
PUT
/admin/users/:userId/ban
Ban/unban user
✅ Admin
GET
/admin/courses
Get all courses (incl. unpublished)
✅ Admin
PUT
/admin/courses/:courseId
Update any course
✅ Admin
DELETE
/admin/courses/:courseId
Delete any course
✅ Admin
GET
/admin/analytics
Get platform analytics
✅ Admin
💾 Database Schema
Entity Relationship Diagram
erDiagram
USER ||--o{ ENROLLMENT : enrolls
USER ||--o{ LESSON_PROGRESS : tracks
USER ||--o{ ACTIVITY_COMPLETION : completes
USER ||--o{ QUIZ_ATTEMPT : attempts
USER ||--o{ SUBMISSION : submits
USER ||--o{ PEER_REVIEW : reviews
USER ||--o{ LIVE_SESSION : hosts
COURSE ||--o{ CHAPTER : contains
COURSE ||--o{ ENROLLMENT : has
COURSE ||--o{ ACTIVITY : has
COURSE ||--o{ QUIZ : has
COURSE ||--o{ LIVE_SESSION : has
CHAPTER ||--o{ LESSON : contains
LESSON ||--o{ LESSON_PROGRESS : has
ACTIVITY ||--o{ ACTIVITY_COMPLETION : has
QUIZ ||--o{ QUIZ_ATTEMPT : has
SUBMISSION ||--o{ PEER_REVIEW : receives
USER {
string clerkId UK
string email UK
string role
}
COURSE {
string title
string slug UK
string status
number price
}
ENROLLMENT {
ObjectId userId FK
ObjectId courseId FK
string status
}
Loading
⚙️ Getting Started
Prerequisites
Node.js v18 or higher
Bun (recommended) or npm for package management
MongoDB (local installation or MongoDB Atlas account)
# Start the backend (development mode)cd backend
npm run dev # Runs on http://localhost:5000# Start the frontend (development mode - new terminal)cd frontend
bun run dev # Runs on http://localhost:3000 (with Turbopack)
🚀 Roadmap
Certificate Generation — Auto-generate certificates upon course completion
Discussion Forums — Per-course Q&A boards
Real-time Chat — Text chat during live sessions
Course Reviews — 5-star rating system with text reviews
Multi-language Support — i18n localization
Mobile App — React Native companion app
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
Made with ❤️ by the Learnix Team
If you found this project helpful, please give it a ⭐!
About
A modern, full-stack Learning Management System (LMS) built with cutting-edge web technologies. Features secure authentication, course management, rich content editing, file uploads with S3, admin dashboard, and integrated Stripe payments. Built with Next.js 15, TypeScript, Prisma, and PostgreSQL.