Skip to content

Anway05/LMS-Portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SkillBridge - Modern Learning Platform

A full-stack online learning platform built with React, Express, MongoDB, and integrated with Clerk authentication, Cloudinary for media storage, and Stripe for payments.

Features

For Students

  • πŸŽ“ Browse and search courses
  • πŸ“š Enroll in courses with Stripe payment
  • πŸŽ₯ Watch video lectures with progress tracking
  • ⭐ Rate and review courses
  • πŸ“Š Track learning progress
  • πŸ’³ Secure payment processing

For Educators

  • πŸ“ Create and manage courses
  • 🎬 Upload video content via Cloudinary
  • πŸ“Š View dashboard with earnings and statistics
  • πŸ‘₯ Track enrolled students
  • ✏️ Edit course content and pricing
  • πŸ—‘οΈ Delete courses

Tech Stack

Frontend

  • React 18 - UI framework
  • React Router v6 - Navigation
  • Clerk - Authentication and user management
  • Axios - HTTP client
  • Tailwind CSS - Styling
  • Quill - Rich text editor for course descriptions
  • React Toastify - Toast notifications
  • Vite - Build tool

Backend

  • Node.js - Runtime
  • Express 5 - Web framework
  • MongoDB - Database
  • Mongoose - ODM for MongoDB
  • Clerk Express - Server-side authentication
  • Cloudinary - Media storage and CDN
  • Stripe - Payment processing
  • Multer - File upload handling
  • Svix - Webhook verification

Project Structure

SkillBridge/
β”œβ”€β”€ client/                 # Frontend React app
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ educator/  # Educator-specific components
β”‚   β”‚   β”‚   └── student/   # Student-specific components
β”‚   β”‚   β”œβ”€β”€ context/       # React context providers
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ educator/  # Educator pages
β”‚   β”‚   β”‚   └── student/   # Student pages
β”‚   β”‚   └── assets/        # Static assets
β”‚   β”œβ”€β”€ public/            # Public assets
β”‚   └── dist/              # Production build
β”‚
β”œβ”€β”€ server/                # Backend Express API
β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”œβ”€β”€ controllers/       # Request handlers
β”‚   β”œβ”€β”€ middlewares/       # Custom middleware
β”‚   β”œβ”€β”€ models/            # Mongoose models
β”‚   └── routes/            # API routes
β”‚
β”œβ”€β”€ DEPLOYMENT.md          # Deployment guide
└── ENV_README.md          # Environment setup guide

Getting Started

Prerequisites

  • Node.js 18+ installed
  • MongoDB (local or MongoDB Atlas)
  • Clerk account for authentication
  • Cloudinary account for media storage
  • Stripe account (optional, for payments)

Installation

  1. Clone the repository
git clone <your-repo-url>
cd LMS
  1. Install dependencies
# Install client dependencies
cd client
npm install

# Install server dependencies
cd ../server
npm install
  1. Configure environment variables

Client (client/.env.local):

VITE_BACKEND_URL=http://localhost:5000
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_key_here

Server (server/.env):

PORT=5000
MONGODB_URI=mongodb://localhost:27017
CLERK_SECRET_KEY=sk_test_your_key_here
CLERK_WEBHOOK_SECRET=whk_your_secret_here
CLOUDINARY_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_SECRET_KEY=your_secret_key
STRIPE_SECRET_KEY=sk_test_your_stripe_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

See ENV_README.md for detailed setup instructions.

  1. Start development servers

Terminal 1 - Backend:

cd server
npm run server

Terminal 2 - Frontend:

cd client
npm run dev

The frontend will be available at http://localhost:5173 and the backend at http://localhost:5000.

API Endpoints

Public Routes

  • GET / - Health check
  • GET /api/course/all - Get all courses
  • GET /api/course/:courseId - Get course details

Protected User Routes

  • GET /api/user/data - Get user data
  • GET /api/user/enrolled-courses - Get user's enrolled courses
  • POST /api/user/checkout - Create Stripe checkout session
  • PUT /api/user/update-progress - Update course progress
  • GET /api/user/course-progress/:courseId - Get course progress

Protected Educator Routes

  • POST /api/educator/update-role - Update user role to educator
  • POST /api/educator/add-course - Add new course
  • GET /api/educator/courses - Get educator's courses
  • GET /api/educator/course/:courseId - Get single course for editing
  • PUT /api/educator/course/:courseId - Update course
  • DELETE /api/educator/course/:courseId - Delete course
  • GET /api/educator/dashboard - Get dashboard data
  • GET /api/educator/enrolled-students - Get enrolled students

Webhook Routes

  • POST /clerk - Clerk user sync webhook
  • POST /stripe - Stripe payment webhook

Database Models

User

  • Stores user information synced from Clerk
  • Tracks enrolled courses
  • References: enrolledCourses (Course)

Course

  • Course details (title, description, price, discount)
  • Course content (chapters and lectures)
  • Enrolled students
  • Ratings and reviews
  • References: educator (User), enrolledStudents (User)

Purchase

  • Payment records
  • Links courses to users
  • Status tracking (pending, completed, failed)
  • References: userId (User), courseId (Course)

CourseProgress

  • Tracks user progress in courses
  • Completed lectures tracking
  • References: userId (User), courseId (Course)

Deployment

See DEPLOYMENT.md for detailed deployment instructions covering:

  • Environment variable setup
  • Building for production
  • Deployment to Vercel/Netlify
  • Webhook configuration
  • Security checklist

Quick Production Build

# Build client
cd client
npm run build

# Preview production build
npm run preview

# Start production server
cd ../server
NODE_ENV=production node server.js

Development Tips

Running in Development

  • Use npm run server (nodemon) for auto-restart on server changes
  • Use npm run dev (Vite) for hot module replacement on client changes

Debugging

  • Check browser console for client-side errors
  • Check server terminal for API errors
  • Use MongoDB Compass to inspect database
  • Use Stripe CLI for webhook testing locally

Code Quality

  • ESLint configured for both client and server
  • All debug console.log statements removed for production
  • Proper error handling with user-facing messages
  • Environment variables for all secrets

Contributing

  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 ISC License.

Support

For issues and questions:

Acknowledgments

  • Clerk for authentication
  • Stripe for payment processing
  • Cloudinary for media management
  • MongoDB Atlas for database hosting

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages