Overview
The dashboard displays key platform metrics and visual charts to help administrators monitor platform health and user activity.Key Statistics
The dashboard tracks six primary metrics:Total Students
Count of all registered student users on the platform
Total Educators
Number of approved educators who can create courses
Total Revenue
Cumulative revenue from all completed purchases
Total Enrollments
Sum of all student enrollments across all courses
Total Courses
Number of courses created on the platform
Pending Applications
Educator applications awaiting review
Visual Analytics
Top Courses by Enrollment
Displays the 6 most popular courses based on student enrollment count
- Course titles (truncated to 22 characters)
- Number of enrolled students per course
- Interactive tooltips with exact enrollment numbers
Course collection, sorted by enrolledStudents array length
Weekly Revenue Chart
Tracks earnings over the last 7 days
- Daily revenue totals
- 7-day trend visualization
- Day labels (weekday + date)
- Revenue formatted in Indian Rupees (₹)
Purchase collection, grouped by date
Navigation
Each stat card is clickable and navigates to the relevant admin section:Students & Educators
Click Total Students or Total Educators to view the User Management page
Revenue
Click Total Revenue to view the Purchase Management page
Enrollments & Courses
Click Total Enrollments or Total Courses to view the Course Management page
Applications
Click Pending Applications to review Educator Applications
API Endpoints
The dashboard fetches data from two endpoints:GET /api/admin/stats
Returns platform-wide statistics:GET /api/admin/chart-data
Returns chart visualization data:Both endpoints require admin authentication via Bearer token
Implementation Details
Real-time Updates
The dashboard loads data on mount using parallel API calls:Dark Mode Support
All components support dark mode with appropriate color schemes:- Light backgrounds with subtle shadows
- Dark backgrounds with border highlights
- Accessible color contrast ratios
Responsive Design
The dashboard adapts to different screen sizes:- Mobile: 2-column grid for stat cards
- Tablet: 3-column grid with collapsed chart details
- Desktop: Full layout with all information visible
Data Aggregation
Revenue Calculation
Revenue Calculation
Revenue is calculated by aggregating all purchases with
status: 'completed' and summing their amount fields. Pending, failed, or refunded purchases are excluded from revenue totals.Enrollment Count
Enrollment Count
Total enrollments are calculated by summing the length of the
enrolledStudents array across all courses using MongoDB aggregation pipeline.Educator Count
Educator Count
Educators are counted from the
EducatorApplication collection where status: 'approved'. This ensures only active educators with approved applications are counted.