Skip to content
KartikManujaPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 LearnHub — Online Course Platform

A full-stack MERN application for online learning. Instructors create and manage courses, students enroll, track progress, and leave reviews. Built with a premium, Udemy-inspired dark-themed UI.

LearnHub License


✨ Features

Authentication & Authorization

  • JWT-based authentication (register, login, logout)
  • Role-based access control — Instructor and Student roles
  • Protected routes on both frontend and backend

For Instructors

  • Create, edit, and delete courses
  • Add, edit, reorder, and delete lessons within courses
  • Dashboard with total enrollments, average ratings, course analytics
  • Publish/unpublish courses

For Students

  • Browse and search courses by keyword, category, level, and rating
  • Enroll and unenroll from courses
  • Watch lessons with embedded video player
  • Track progress — mark lessons as complete, see % completed per course
  • Rate and review courses (one review per course)
  • Personal dashboard with enrolled courses and progress bars

UI/UX

  • Premium dark-themed design with glassmorphism effects
  • Responsive layout (desktop, tablet, mobile)
  • Smooth animations and micro-interactions
  • Interactive star ratings, progress bars, and more

🛠️ Tech Stack

Layer Technology
Frontend React.js + Vite + Plain CSS
Backend Node.js + Express.js
Database MongoDB + Mongoose
Auth JWT + bcryptjs

📁 Project Structure

learnhub/
├── client/                     # React frontend (Vite)
│   └── src/
│       ├── components/         # Reusable UI components
│       ├── context/            # Auth context (Context API)
│       ├── pages/              # Page components
│       ├── utils/              # API utility
│       ├── App.jsx             # Root with routing
│       └── index.css           # Global design system
├── server/                     # Express backend
│   ├── config/                 # Database config
│   ├── controllers/            # Route handlers
│   ├── middleware/              # Auth & role middleware
│   ├── models/                 # Mongoose schemas
│   ├── routes/                 # Express routes
│   └── server.js               # Entry point
├── package.json                # Root scripts (concurrently)
└── README.md

📊 MongoDB Schema

User        → role: instructor / student
Course      → ref: User (instructor), category, lessons[]
Lesson      → ref: Course, title, videoUrl, order
Enrollment  → ref: User + Course, completedLessons[], progress%
Review      → ref: User + Course, rating, comment

🚀 Getting Started

Prerequisites

1. Clone the Repository

git clone <your-repo-url>
cd learnhub

2. Configure Environment Variables

cp server/.env.example server/.env

Edit server/.env with your values:

PORT=5000
MONGO_URI=mongodb://localhost:27017/learnhub
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRE=7d

Using MongoDB Atlas? Replace MONGO_URI with your Atlas connection string: mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/learnhub

3. Install Dependencies

# Install all dependencies (root, server, client)
npm run install-all

Or install individually:

# Root dependencies
npm install

# Server dependencies
cd server && npm install

# Client dependencies
cd ../client && npm install

4. Run the Application

# From root — runs both server and client concurrently
npm run dev

Or run separately:

# Terminal 1: Backend (port 5000)
npm run server

# Terminal 2: Frontend (port 5173)
npm run client

5. Open in Browser

Navigate to http://localhost:5173


📡 API Endpoints

Auth (/api/auth)

Method Endpoint Auth Description
POST /register Public Register a new user
POST /login Public Login, returns JWT
GET /me Required Get current user

Courses (/api/courses)

Method Endpoint Auth Description
GET / Public List courses (search/filter/page)
GET /:id Public Get course details
POST / Instructor Create course
PUT /:id Instructor Update course (owner only)
DELETE /:id Instructor Delete course + cascade

Lessons (/api/courses/:courseId/lessons)

Method Endpoint Auth Description
GET / Public Get course lessons
POST / Instructor Add lesson
PUT /:lessonId Instructor Edit lesson
DELETE /:lessonId Instructor Delete lesson

Enrollments (/api/enrollments)

Method Endpoint Auth Description
POST /:courseId/enroll Student Enroll in course
DELETE /:courseId/unenroll Student Unenroll from course
GET /my Student My enrollments
GET /:courseId/check Auth Check enrollment

Progress (/api/progress)

Method Endpoint Auth Description
PUT /:enrollmentId/complete/:lessonId Student Mark complete
PUT /:enrollmentId/uncomplete/:lessonId Student Mark incomplete
GET /:enrollmentId Auth Get progress

Reviews (/api/reviews)

Method Endpoint Auth Description
GET /courses/:courseId Public Get course reviews
POST /courses/:courseId Student Add review
PUT /:reviewId Student Edit review
DELETE /:reviewId Student Delete review

🎨 Design

The UI features a premium dark theme with:

  • Deep purple (#6C3CE1) primary + teal (#00C9A7) accent palette
  • Glassmorphism effects on cards and navigation
  • Smooth micro-animations and transitions
  • Inter font from Google Fonts
  • Fully responsive design (desktop, tablet, mobile)

📌 Skills Demonstrated

Skill Implementation
Role-based Auth Instructor / Student middleware
Complex MongoDB User → Course → Lesson → Enrollment → Review
REST API Design 5 models, 6 route groups, full CRUD
Business Logic Progress tracking, enrollment system
React Dashboards, protected routes, Context API
Real Product Feel Udemy-style course platform with premium UI

📝 License

MIT License — feel free to use this project for learning and portfolios.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages