Skip to content

a-y-a-n-das/CourseHive

Repository files navigation

πŸ“š CourseHive - Online Course Platform

A modern full-stack course-selling platform built with React, Node.js, Express, and MongoDB. CourseHive enables educators to create and manage courses while providing students with seamless course access, video/PDF lessons, and secure content delivery via AWS S3.

🌐 Live Link

πŸš€ CourseHive - Live Demo

Experience the platform live with full functionality including course browsing, purchasing, and lesson management.

πŸ”— Important URLs

Student Portal

  • Sign Up: https://npm-app.duckdns.org/signup
  • Sign In: https://npm-app.duckdns.org/signin
  • Dashboard: https://npm-app.duckdns.org/ (after login)

Educator Portal

  • Sign Up: https://npm-app.duckdns.org/educatorsignup
  • Sign In: https://npm-app.duckdns.org/educators
  • Dashboard: Access after login to create and manage courses

πŸ“‹ Upcoming Features

  • Enhanced analytics dashboard for educators (course views, revenue tracking)
  • Course progress tracking for students (% completed, certificates)
  • Course ratings and reviews system
  • Payment gateway integration (Razorpay)
  • Email notifications for course updates and purchases

✨ Features

For Students

  • πŸ” Secure Authentication - JWT-based user authentication
  • πŸŽ“ Course Browsing - Explore available courses with detailed information
  • πŸ’³ Secure Payment - Razorpay integration with payment verification
  • πŸ“Ή Rich Content Access - Watch video lessons and read PDF materials
  • 🎯 Personalized Dashboard - Track purchased courses and progress

For Educators

  • πŸ‘¨β€πŸ« Separate Educator Portal - Dedicated sign-in and dashboard
  • βž• Course Creation - Create courses with metadata (name, price, level, duration, category)
  • πŸ–ΌοΈ Thumbnail Upload - Upload course images via ImgBB integration
  • πŸ“Š Course Management - View and manage all created courses
  • πŸ“¦ Lesson Management - Add, view, and delete video/PDF lessons
  • πŸ“€ Direct S3 Upload - Upload lessons directly to AWS S3 with presigned URLs
  • ♻️ Real-time Updates - Lesson list updates instantly after add/delete operations
  • πŸ—‘οΈ Smart Deletion - Automatic cleanup of S3 files when lessons are deleted

Technical Highlights

  • ⚑ Fast Development - Vite + React with HMR
  • 🎨 Modern UI - Material-UI (MUI) components with responsive design
  • πŸ”’ Secure Content - Pre-signed S3 URLs with time-limited access (5 min expiry)
  • πŸ’° Payment Integration - Razorpay with signature verification and webhook handling
  • 🌐 RESTful API - Express backend with protected routes
  • πŸ—„οΈ MongoDB Atlas - Cloud database with Mongoose ODM
  • πŸš€ Cloud Storage - AWS S3 for scalable video/PDF hosting
  • 🐳 Containerized - Docker & Docker Compose for consistent deployments
  • πŸ” Security Best Practices - Non-root containers, multi-stage builds, minimal attack surface

πŸ› οΈ Tech Stack

Frontend

  • React 19 - Modern React with hooks
  • Vite 7 - Lightning-fast build tool
  • Material-UI (MUI) 7 - Component library for polished UI
  • React Router Dom 7 - Client-side routing
  • ESLint - Code linting and quality

Backend

  • Node.js - JavaScript runtime
  • Express 5 - Web framework
  • MongoDB + Mongoose - Database and ODM
  • JWT - Token-based authentication
  • AWS SDK v3 - S3 client for content delivery
  • Multer - File upload handling
  • CORS - Cross-origin resource sharing
  • Razorpay - Payment gateway integration

Cloud Services

  • AWS S3 - Video and PDF storage
  • MongoDB Atlas - Managed MongoDB hosting
  • ImgBB - Course thumbnail hosting

DevOps & Containerization

  • Docker - Container platform for consistent deployments
  • Docker Compose - Multi-container orchestration
  • Nginx - Reverse proxy and static file serving (in containers)

πŸ“ Project Structure

Course-selling/
β”œβ”€β”€ backend/              # Express API server
β”‚   β”œβ”€β”€ controllers/      # Route handlers (auth, student, educator, payment)
β”‚   β”œβ”€β”€ models/          # MongoDB schemas
β”‚   β”œβ”€β”€ routes/          # API routes
β”‚   β”œβ”€β”€ Dockerfile       # Backend container config
β”‚   └── server.js        # Entry point
β”œβ”€β”€ src/                 # React frontend
β”‚   β”œβ”€β”€ components/      # React components (Appbar, CourseContent, Student, Educator)
β”‚   β”œβ”€β”€ App.jsx
β”‚   └── main.jsx
β”œβ”€β”€ docker-compose.yml   # Multi-container orchestration
β”œβ”€β”€ Dockerfile           # Frontend container config
└── nginx.conf           # Reverse proxy config

πŸš€ Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • MongoDB Atlas account (or local MongoDB)
  • AWS Account with S3 bucket configured
  • ImgBB API Key (for thumbnails)
  • Razorpay Account (for payment integration)
  • Docker & Docker Compose (optional, for containerized deployment)

Installation

  1. Clone the repository

    git clone https://github.com/a-y-a-n-das/coursehive.git
    cd Course-selling
  2. Install frontend dependencies

    npm install
  3. Install backend dependencies

    cd backend
    npm install
    cd ..

Configuration

Backend Environment Variables

Create backend/.env:

PORT=5000
SECRET=your_jwt_secret_key_here
TOKEN=your_internal_api_token_here
BACKEND_URL=http://localhost:5000
MONGODB_URL=mongodb+srv://username:[email protected]/Course-app
IMGBB_KEY=your_imgbb_api_key
AWS_REGION=ap-south-1
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
S3_BUCKET_NAME=your_bucket_name
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret

Frontend Environment Variables

Create .env in the root:

VITE_API_URL=http://localhost:5000
VITE_RAZORPAY_KEY_ID=your_razorpay_key_id

Running the Application

Development Mode (Traditional)

  1. Start the backend server (from backend/ folder):

    cd backend
    node server.js
    # or use nodemon for auto-restart:
    nodemon server.js
  2. Start the frontend dev server (from root):

    npm run dev
  3. Access the app

    • Frontend: http://localhost:5173
    • Backend API: http://localhost:5000

Development Mode (Docker) 🐳

  1. Start all services with Docker Compose:

    docker compose up -d
  2. Access the app

    • Frontend: http://localhost
    • Backend API: http://localhost:5000
  3. View logs:

    # All services
    docker compose logs -f
    
    # Specific service
    docker compose logs -f backend
    docker compose logs -f frontend
  4. Stop services:

    docker compose down

Production Build

Traditional:

# Build frontend
npm run build

# Preview production build
npm run preview

Docker:

# Build images
docker compose build

# Run in production mode
docker compose up -d

# Or build and run together
docker compose up -d --build

πŸ”‘ Key Features & Architecture

Authentication: JWT-based auth with 12-hour sessions. Protected routes require Authorization: Bearer <token> header.

Content Delivery: Videos/PDFs stored in AWS S3 with pre-signed URLs (5-min expiry). Direct upload from frontend to S3 using presigned URLs.

Payment Flow: Razorpay integration with server-side signature verification for secure transactions.

Docker Best Practices Implemented

  • βœ… Multi-stage builds - Separate build and runtime stages
  • βœ… Layer caching - Optimized Dockerfile instruction order
  • βœ… Minimal base images - Using node:24-slim and nginx:alpine
  • βœ… Security - Non-root user, no secrets in images
  • βœ… .dockerignore - Exclude unnecessary files
  • βœ… Health checks - Container health monitoring
  • βœ… Restart policies - Auto-restart on failure
  • βœ… Environment variables - Externalized configuration

Docker Image Sizes

Service Build Stage Final Image Savings
Backend ~500MB ~250MB 50%
Frontend ~800MB ~50MB 94%

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Ayan Das

πŸ™ Acknowledgments

  • Material-UI for the component library
  • AWS for reliable cloud storage
  • MongoDB Atlas for managed database hosting
  • Vite team for the amazing build tool

Built with ❀️ by Ayan Das

πŸ’‘ Development Credits

README documentation generated by GitHub Copilot powered by Claude Sonnet 4.5

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages