Skip to content

πŸŽ“ A full-featured MERN backend for an EdTech platform. Supports JWT authentication, role-based access (student/admin), course creation & enrollment, quizzes integrated into courses, real-time scoring, analytics, and leaderboards.

Notifications You must be signed in to change notification settings

buildwithmehul/mern-edtech-platform-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 MERN Education Platform Backend (API-Only)

Robust Node.js backend for a full-fledged education + quiz platform with JWT Auth, role-based dashboards, course management, quiz creation, scoring, leaderboards, and student performance tracking.

βœ… Built from scratch using Node.js, Express, and MongoDB, this backend powers student-teacher interaction for an interactive learning platform. Designed for clarity, security, and extensibility.


πŸš€ Features

πŸ” Auth System

  • βœ… Secure JWT-based login & registration
  • βœ… Roles: student, teacher
  • βœ… Role-based route access (middleware protected)

πŸŽ“ Course Management

  • πŸ‘¨β€πŸ« Teachers can create, manage their courses
  • πŸ‘©β€πŸŽ“ Students can enroll only via backend-auth

❓ Quiz Engine

  • πŸ“ Teachers can create quizzes:

    • Add any number of questions
    • Associate them with existing courses
    • Control visibility (draft / publish)
    • Set quiz start & end time ⏳
  • πŸ” Students can:

    • View only enrolled course quizzes
    • Take quiz once (attempt restriction)
    • Receive immediate scoring
    • Receive certificate if passed threshold criteria πŸŽ“
    • Receive feedback for each answer (correct/wrong)
    • Receive email report after quiz attempt πŸ“§
    • Blocked from accessing quiz outside time window

πŸ† Leaderboards

  • βœ… Quiz-specific leaderboard
  • βœ… Global leaderboard across all quizzes

πŸ“Š Student Dashboard

  • βœ… View enrolled courses
  • βœ… View available quizzes
  • βœ… View attempt score history
  • βœ… View per-quiz detailed per-question feedback

πŸ“ˆ Teacher Dashboard

  • βœ… View all created courses
  • βœ… View quizzes with stats (students, attempts)
  • βœ… Access any student’s dashboard via dropdown
  • βœ… Teachers can monitor individual student entire performance history

πŸ“ Project Structure

πŸ“¦ Quiz-App-Backend
β”œβ”€β”€ controllers/
β”‚ β”œβ”€β”€ authController.js
β”‚ β”œβ”€β”€ courseController.js
β”‚ β”œβ”€β”€ quizController.js
β”‚ └── dashboardController.js
β”œβ”€β”€ middleware/
β”‚ β”œβ”€β”€ authMiddleware.js
β”‚ └── roleMiddleware.js
β”œβ”€β”€ models/
β”‚ β”œβ”€β”€ User.js
β”‚ β”œβ”€β”€ Course.js
β”‚ β”œβ”€β”€ Quiz.js
β”‚ β”œβ”€β”€ QuizAttempt.js
β”‚ └── Certificate.js
β”œβ”€β”€ routes/
β”‚ β”œβ”€β”€ authRoutes.js
β”‚ β”œβ”€β”€ courseRoutes.js
β”‚ β”œβ”€β”€ quizRoutes.js
β”‚ └── dashboardRoutes.js
β”œβ”€β”€ server.js
β”œβ”€β”€ config/
β”‚ └── db.js
└── utils/
β”œβ”€β”€ tokenUtils.js
└── emailSender.js

βš™οΈ Tech Stack

Layer Tech Used
Language JavaScript (ES6)
Backend Node.js + Express
Database MongoDB + Mongoose ORM
Auth JWT Tokens
Role Guard Middleware based restriction
Email Nodemailer (Gmail SMTP)
Testing Postman

πŸ”’ Authentication Flow

/api/auth/register β†’ create account
/api/auth/login    β†’ returns token + user info

πŸ” All routes except login/register are protected.
πŸ” Student/Teacher routes have role guard.

πŸ”„ API Overview

Method Route Description
POST /api/auth/register Register as student/teacher
POST /api/auth/login Login, returns JWT
POST /api/courses/:id/enroll Student enrolls in course
GET /api/courses View all courses (by role)
POST /api/quizzes Create a quiz (teacher)
GET /api/quizzes Get available quizzes (by role)
GET /api/quizzes/:id Get specific quiz
POST /api/quizzes/:quizId/attempt Submit a quiz
GET /api/quizzes/:quizId/leaderboard Quiz leaderboard
GET /api/leaderboard/global Global leaderboard
GET /api/dashboard/student Student’s own dashboard
GET /api/dashboard/:id/student Teacher views any student
GET /api/quizzes/:id/certificate Receive Certificate if eligible

πŸ§ͺ How to Test

  1. Clone the repo and run:
npm install
npm run dev
  1. Use Postman to:

    • Register/login as both roles
    • Create course (teacher)
    • Enroll (student)
    • Create quiz (set startTime, endTime, and duration)
    • Attempt quiz (respect time window!)
    • Check leaderboard & dashboard routes
    • Confirm email is received after attempt
    • Confirm cert is generated if passed

πŸ’‘ Possible Extensions

  • βœ… Draft/Publish quizzes
  • βœ… One attempt per student
  • βœ… Quiz feedback (per question)
  • βœ… Global leaderboard
  • βœ… Email report to student after attempt
  • βœ… Timed/expiring quizzes ⏳
  • πŸ”œ Tag-based quiz filters
  • πŸ”œ Certificate verification link

πŸ‘₯ Author

Built by Mehul Khanna

Crafted with ❀️, caffeine, and hundreds of test requests.


About

πŸŽ“ A full-featured MERN backend for an EdTech platform. Supports JWT authentication, role-based access (student/admin), course creation & enrollment, quizzes integrated into courses, real-time scoring, analytics, and leaderboards.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published