Skip to main content
The Course Management interface provides administrators with a comprehensive view of all courses on the platform, including enrollment metrics, revenue data, and publication status.

Overview

Administrators can monitor course performance, track revenue generation, and view detailed information about each course and its educator.
This page displays real-time data for all courses, including both published and draft courses

Key Features

Search Functionality

Filter courses by:
  • Course Title: Partial matches supported (case-insensitive)
  • Educator Name: Search by the course creator’s name
const filtered = courses.filter((c) =>
  c.courseTitle.toLowerCase().includes(search.toLowerCase()) ||
  c.educator?.name?.toLowerCase().includes(search.toLowerCase())
)

Summary Statistics

The page header displays aggregate metrics:

Total Courses

Count of all courses on the platform

Total Revenue

Cumulative revenue from course purchases (₹)

Total Enrollments

Sum of all student enrollments across courses

Course Information Table

Each course entry displays comprehensive information:

Columns

ColumnDescriptionVisibility
CourseTitle and creation dateAlways visible
EducatorCreator name and emailHidden on mobile
EnrollmentsNumber of enrolled studentsAlways visible
RevenueTotal earnings and purchase countHidden on tablet
PriceCurrent price (with discount if applicable)Hidden on tablet
StatusPublished or Draft badgeHidden on mobile

Course Details

  • Full course title with line clamping
  • Creation date formatted as “15 Jan 2024”

Pricing Display

Regular Pricing

When no discount is applied:
₹2,499

Discounted Pricing

When a discount is active:
₹1,999
₹2,499  (struck through)
The effective price is calculated as:
const effectivePrice = discount > 0
  ? coursePrice - (coursePrice * discount) / 100
  : coursePrice

Status Indicators

Teal badge indicating the course is live and visible to students

API Integration

GET /api/admin/courses

Fetches all courses with enhanced statistics:
{
  "success": true,
  "courses": [
    {
      "_id": "course123",
      "courseTitle": "Introduction to React",
      "educatorId": {
        "name": "John Smith",
        "email": "john@example.com"
      },
      "enrolledCount": 234,
      "isPublished": true,
      "coursePrice": 2499,
      "discount": 20,
      "createdAt": "2024-01-15T10:30:00Z",
      "revenue": 467661,
      "purchases": 267
    }
  ]
}
Requires admin authentication via Bearer token

Data Calculation

Revenue Aggregation

1

Filter Purchases

Only completed purchases (status: 'completed') are included
2

Group by Course

Purchases are grouped by courseId using MongoDB aggregation
3

Sum Amounts

Total revenue per course is calculated by summing amount fields
4

Count Transactions

Number of successful purchases is counted per course
Backend aggregation pipeline:
const purchases = await Purchase.aggregate([
  { $match: { status: 'completed' } },
  {
    $group: {
      _id: '$courseId',
      revenue: { $sum: '$amount' },
      count: { $sum: 1 }
    }
  }
])

Enrollment Counting

Enrollment count is derived from the enrolledStudents array length:
enrolledCount: course.enrolledStudents.length

Responsive Behavior

Mobile

Shows course title, enrollments, and status only

Tablet

Adds educator information, hides revenue and price details

Desktop

Displays all columns with complete information

Course Sorting

Courses are sorted by creation date in descending order:
.sort({ createdAt: -1 })
This ensures the newest courses appear first in the list.

Empty States

When no courses match the search criteria:
  • With search: “No courses match your search”
  • Without search: “No courses yet”

Performance Considerations

Database Query Optimization

The backend uses:
  • Field selection to reduce payload size
  • Population for educator details
  • Aggregation for purchase statistics
const courses = await Course.find()
  .select('courseTitle educator enrolledStudents isPublished coursePrice discount createdAt')
  .populate('educatorId', 'name email')
  .sort({ createdAt: -1 })

Client-side Filtering

Search filtering happens on the client for instant results without additional API calls.

Use Cases

Identify top-earning courses and compare pricing strategies across different categories.
Track which courses are most popular and identify courses that may need promotion.
View course creation activity per educator and identify prolific content creators.
Monitor unpublished courses to follow up with educators about completion status.
Use the search feature to quickly find specific courses when handling student support inquiries or educator questions.