Skip to content

Leebana/elearningapp

Repository files navigation

E-Learning Platform

A comprehensive, modern e-learning platform built with Next.js, Node.js, PostgreSQL, and AI-powered features.

πŸš€ Features

Core Features

  • User Authentication - Secure JWT-based auth with role management (Student, Instructor, Admin)
  • Course Management - Create, edit, and manage courses with modular structure
  • Video Learning - HD video player with playback controls, bookmarks, and progress tracking
  • Interactive Assessments - Quizzes, assignments, and instant feedback
  • Progress Tracking - Comprehensive analytics and learning dashboards
  • Discussion Forums - Course-specific Q&A and community features
  • Gamification - Badges, achievements, and learning streaks
  • AI Recommendations - Personalized course suggestions
  • Payment Integration - Stripe integration for course purchases
  • Mobile Responsive - Works seamlessly on all devices

Tech Stack

Frontend

  • Framework: Next.js 14 (React 18)
  • Styling: TailwindCSS + shadcn/ui
  • State Management: Zustand
  • Forms: React Hook Form + Zod
  • API Client: Axios
  • Video Player: Video.js
  • Icons: Lucide React

Backend

  • Runtime: Node.js 20+
  • Framework: Express.js
  • Database: PostgreSQL 15+
  • ORM: Prisma
  • Authentication: JWT + bcrypt
  • File Storage: AWS S3 / Local storage
  • Payment: Stripe
  • Email: Nodemailer

DevOps

  • Containerization: Docker + Docker Compose
  • CI/CD: GitHub Actions
  • Hosting: Vercel (Frontend) + Railway/Render (Backend)

πŸ“ Project Structure

elearning-platform/
β”œβ”€β”€ backend/                 # Node.js/Express API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/         # Configuration files
β”‚   β”‚   β”œβ”€β”€ controllers/    # Route controllers
β”‚   β”‚   β”œβ”€β”€ middleware/     # Custom middleware
β”‚   β”‚   β”œβ”€β”€ models/         # Prisma models
β”‚   β”‚   β”œβ”€β”€ routes/         # API routes
β”‚   β”‚   β”œβ”€β”€ services/       # Business logic
β”‚   β”‚   β”œβ”€β”€ utils/          # Utility functions
β”‚   β”‚   └── server.js       # Entry point
β”‚   β”œβ”€β”€ prisma/             # Database schema & migrations
β”‚   β”œβ”€β”€ tests/              # API tests
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/               # Next.js application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/           # Next.js 14 app directory
β”‚   β”‚   β”œβ”€β”€ components/    # React components
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom hooks
β”‚   β”‚   β”œβ”€β”€ lib/           # Utilities & helpers
β”‚   β”‚   β”œβ”€β”€ store/         # Zustand stores
β”‚   β”‚   └── styles/        # Global styles
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   └── package.json
β”‚
β”œβ”€β”€ docs/                  # Documentation
β”œβ”€β”€ docker-compose.yml     # Docker setup
└── README.md

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js 20+ and npm/yarn
  • PostgreSQL 15+
  • Docker (optional)

Option 1: Local Setup

1. Clone the repository

git clone <repository-url>
cd elearning-platform

2. Backend Setup

cd backend
npm install

# Create .env file
cp .env.example .env

# Update .env with your configuration
# DATABASE_URL, JWT_SECRET, STRIPE_SECRET_KEY, etc.

# Run database migrations
npx prisma migrate dev

# Seed database (optional)
npx prisma db seed

# Start backend server
npm run dev

Backend runs on http://localhost:5000

3. Frontend Setup

cd frontend
npm install

# Create .env.local file
cp .env.example .env.local

# Update with backend API URL
# NEXT_PUBLIC_API_URL=http://localhost:5000

# Start frontend
npm run dev

Frontend runs on http://localhost:3000

Option 2: Docker Setup

# Start all services
docker-compose up -d

# Run migrations
docker-compose exec backend npx prisma migrate dev

# View logs
docker-compose logs -f

πŸ”§ Environment Variables

Backend (.env)

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/elearning"

# JWT
JWT_SECRET="your-super-secret-jwt-key"
JWT_EXPIRES_IN="7d"

# Server
PORT=5000
NODE_ENV="development"

# AWS S3 (for file uploads)
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
AWS_REGION="us-east-1"
AWS_S3_BUCKET="elearning-uploads"

# Stripe
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."

# Email
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"

# Frontend URL
FRONTEND_URL="http://localhost:3000"

Frontend (.env.local)

NEXT_PUBLIC_API_URL="http://localhost:5000"
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."

πŸ“š API Documentation

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • POST /api/auth/logout - Logout user
  • GET /api/auth/me - Get current user
  • POST /api/auth/forgot-password - Request password reset
  • POST /api/auth/reset-password - Reset password

Users

  • GET /api/users/:id - Get user profile
  • PUT /api/users/:id - Update user profile
  • GET /api/users/:id/courses - Get user's enrolled courses

Courses

  • GET /api/courses - Get all courses (with filters)
  • GET /api/courses/:id - Get course details
  • POST /api/courses - Create course (instructor only)
  • PUT /api/courses/:id - Update course
  • DELETE /api/courses/:id - Delete course
  • POST /api/courses/:id/enroll - Enroll in course
  • GET /api/courses/:id/lessons - Get course lessons

Lessons

  • GET /api/lessons/:id - Get lesson details
  • POST /api/lessons - Create lesson
  • PUT /api/lessons/:id - Update lesson
  • POST /api/lessons/:id/complete - Mark lesson complete

Quizzes

  • GET /api/quizzes/:id - Get quiz
  • POST /api/quizzes/:id/submit - Submit quiz answers
  • GET /api/quizzes/:id/results - Get quiz results

Progress

  • GET /api/progress/courses/:courseId - Get course progress
  • GET /api/progress/dashboard - Get user dashboard data

Payments

  • POST /api/payments/create-checkout - Create Stripe checkout
  • POST /api/payments/webhook - Stripe webhook handler

πŸ§ͺ Testing

Backend Tests

cd backend
npm test                 # Run all tests
npm run test:watch      # Watch mode
npm run test:coverage   # Coverage report

Frontend Tests

cd frontend
npm test                # Run all tests
npm run test:e2e        # E2E tests with Playwright

πŸš€ Deployment

Frontend (Vercel)

cd frontend
vercel deploy --prod

Backend (Railway/Render)

  1. Connect your GitHub repository
  2. Set environment variables
  3. Deploy automatically on push

Database (Supabase/Neon)

  1. Create PostgreSQL database
  2. Update DATABASE_URL in backend .env
  3. Run migrations: npx prisma migrate deploy

πŸ“– User Guide

For Students

  1. Sign Up - Create account with email
  2. Browse Courses - Explore course catalog
  3. Enroll - Purchase or enroll in free courses
  4. Learn - Watch videos, complete quizzes
  5. Track Progress - Monitor your learning journey
  6. Earn Certificates - Complete courses for certificates

For Instructors

  1. Apply - Request instructor access
  2. Create Course - Build course with lessons
  3. Upload Content - Add videos, materials, quizzes
  4. Publish - Make course available to students
  5. Monitor - Track student progress and engagement
  6. Earn - Receive revenue share from enrollments

For Admins

  1. Dashboard - View platform analytics
  2. Manage Users - Approve instructors, moderate content
  3. Monitor - Track platform health and metrics
  4. Configure - Adjust platform settings

🀝 Contributing

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

πŸ“ License

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

πŸ‘₯ Team

  • Product Manager
  • Lead Developer
  • UI/UX Designer
  • Backend Developer
  • Frontend Developer

πŸ“ž Support

πŸ—ΊοΈ Roadmap

Phase 1 (Current) - MVP

  • User authentication
  • Course management
  • Video player
  • Basic quizzes
  • Payment integration

Phase 2 - Enhancement

  • Live sessions
  • Advanced analytics
  • Mobile apps
  • AI recommendations
  • Discussion forums

Phase 3 - Scale

  • Multi-language support
  • Advanced gamification
  • Corporate features
  • API marketplace
  • AR/VR experiences

⚑ Performance

  • Lighthouse Score: 95+
  • First Contentful Paint: < 1.5s
  • Time to Interactive: < 3.5s
  • API Response Time: < 500ms

πŸ”’ Security

  • HTTPS encryption
  • JWT authentication
  • SQL injection protection
  • XSS prevention
  • CSRF protection
  • Rate limiting
  • Data encryption at rest

Built with ❀️ by the E-Learning Platform Team

About

Learning Tool for making lesson plans

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages