Skip to main content

Overview

SkillRise courses are structured hierarchically with courses containing chapters, and chapters containing lectures. The system automatically calculates course statistics and manages student enrollments.

Course Structure

Data Model

The Course schema implements a flexible nested structure:
server/models/Course.js
The nested structure (Course → Chapter → Lecture) is stored as embedded documents for efficient querying and atomic updates.

Course Hierarchy

Creating Courses

Add New Course

Educators can create courses with automatic statistic calculation:
server/controllers/educatorController.js
1

Upload Validation

Verify that a thumbnail image has been uploaded before processing.
2

Statistics Calculation

Automatically calculate total lectures and duration by traversing the course content hierarchy.
3

Database Creation

Create the course document with all calculated metadata.
4

Image Upload

Upload thumbnail to Cloudinary and store the secure URL.

Retrieving Courses

Get All Published Courses

Public endpoint for browsing courses:
server/controllers/courseController.js

Get Course Details with Access Control

Retrieve course details with conditional lecture URL access:
server/controllers/courseController.js
Lecture URLs are hidden for non-preview lectures to prevent unauthorized access to paid content.

Progress Tracking

Course Progress Model

server/models/CourseProgress.js
The unique compound index on userId and courseId ensures each user has exactly one progress record per course.

Educator Dashboard

Dashboard Statistics

Educators can view comprehensive course statistics:
server/controllers/educatorController.js

Key Features

Hierarchical Structure

Three-level hierarchy (Course → Chapter → Lecture) allows flexible content organization.

Free Previews

Individual lectures can be marked as preview-free for marketing purposes.

Automatic Calculations

Total lectures and duration are calculated automatically from course content.

Progress Tracking

Per-user progress tracking with completed lecture arrays.

Access Control

Lecture URLs are hidden for non-enrolled users unless marked as preview-free.

Ratings System

Built-in course ratings with average and total counts.

Course States

Course is visible only to the educator. Used for content development before release.
Course is visible to all users and available for enrollment.
User has purchased the course and has full access to all lectures.

Best Practices

Performance Optimization: Use .select() to exclude large arrays (courseContent, courseRatings, enrolledStudents) when listing multiple courses.
Security: Always verify educator ownership before allowing course modifications.
Content Protection: Never expose lecture URLs to unenrolled users except for preview lectures.

Next Steps

Payment System

Learn how students enroll in courses

AI Features

Discover AI-powered quizzes and learning paths

Analytics

Track student progress and engagement