Skip to content

JAGADISHSUNILPEDNEKAR/edunexus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

140 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

EduNexus โ€” Mini Learning Management System

A full-stack MERN application for online learning with course management, video lectures, assignments, and real-time chat.

Build Status

๐Ÿ“‹ Table of Contents

โœจ Features

Core Features (MVP)

  • โœ… Authentication & Authorization: JWT-based login/signup with role-based access control
  • โœ… Course Management: Create, edit, delete, and view courses
  • โœ… Video Lectures: Upload and stream video lectures (Cloudinary/local storage)
  • โœ… Assignments: Upload assignments and submit solutions
  • โœ… Real-time Chat: Course-specific chat rooms using Socket.io
  • โœ… Admin Panel: Manage users, courses, and moderate content
  • โœ… Responsive Design: Mobile-friendly interface with Tailwind CSS

User Roles

  1. Student: Enroll in courses, watch lectures, submit assignments, participate in chat
  2. Instructor: Create/manage courses, upload lectures/assignments, view submissions
  3. Admin: Full platform oversight, user management, content moderation

๐Ÿ›  Tech Stack

Backend

  • Node.js v18+ & Express.js - Server framework
  • MongoDB & Mongoose - Database and ODM
  • JWT - Authentication
  • bcrypt - Password hashing
  • Socket.io - Real-time communication
  • Cloudinary - Video/file hosting (optional)
  • express-validator - Input validation
  • multer - File upload handling

Frontend

  • React 18 (with Vite) - UI library
  • React Router v6 - Routing
  • Context API - State management
  • Axios - HTTP client
  • Socket.io-client - Real-time client
  • Tailwind CSS - Styling

DevOps & Testing

  • Jest & Supertest - Backend testing
  • Vitest & React Testing Library - Frontend testing
  • GitHub Actions - CI/CD pipeline
  • ESLint & Prettier - Code quality

๐Ÿ“ฆ Prerequisites

Before you begin, ensure you have the following installed:

๐Ÿš€ Installation

1. Clone the repository

git clone https://github.com/yourusername/edunexus.git
cd edunexus

2. Install server dependencies

cd server
npm install

3. Install client dependencies

cd ../client
npm install

Alternatively, install all dependencies at once from the root:

npm run install:all

๐Ÿ” Environment Setup

Server Environment Variables

Create server/.env from server/.env.example:

NODE_ENV=development
PORT=5000

# Database
MONGO_URI=mongodb://localhost:27017/edunexus

# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_change_in_production
JWT_EXPIRE=7d

# Bcrypt
BCRYPT_SALT_ROUNDS=10

# Cloudinary (Optional - for video uploads)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Client URL (for CORS)
CLIENT_URL=http://localhost:5173

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=5

Client Environment Variables

Create client/.env from client/.env.example:

VITE_API_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000

Important Notes:

  • Never commit .env files to version control
  • Generate a strong JWT secret for production: openssl rand -base64 32
  • For production, use MongoDB Atlas or a managed MongoDB service
  • Cloudinary is optional; the app falls back to local file storage

๐ŸŽฌ Running the Application

Step 1: Start MongoDB

If using local MongoDB:

mongod

If using MongoDB Atlas: Update MONGO_URI in server/.env with your connection string.

Step 2: Seed the Database (First Time Only)

cd server
npm run seed

This creates:

  • 1 Admin user
  • 1 Instructor user
  • 2 Student users
  • 3 Sample courses with lectures
  • 1 Sample assignment
  • Sample chat messages

Step 3: Start Backend Server

cd server
npm run dev

Backend will run on http://localhost:5000

Step 4: Start Frontend Development Server

Open a new terminal:

cd client
npm run dev

Frontend will run on http://localhost:5173

Alternative: Run Both Servers Concurrently

From the project root:

npm run dev

Production Mode

Backend:

cd server
npm start

Frontend (build and preview):

cd client
npm run build
npm run preview

๐Ÿ‘ฅ Demo Credentials

After running the seed script, use these credentials to explore different roles:

Role Email Password Description
Admin [email protected] Admin@123 Full platform access
Instructor [email protected] Instructor@123 Create/manage courses
Student 1 [email protected] Student@123 Enrolled in courses
Student 2 [email protected] Student@123 Enrolled in courses

๐Ÿ“š API Documentation

Detailed API documentation is available in docs/API.md

Quick Reference

Base URL: http://localhost:5000/api

Authentication:

  • POST /auth/register - Register new user
  • POST /auth/login - Login
  • POST /auth/logout - Logout
  • GET /auth/me - Get current user

Courses:

  • GET /courses - List all courses
  • POST /courses - Create course (instructor)
  • GET /courses/:id - Get course details
  • PUT /courses/:id - Update course (instructor)
  • DELETE /courses/:id - Delete course (instructor/admin)
  • POST /courses/:id/enroll - Enroll in course (student)

Assignments:

  • GET /assignments/course/:courseId - List course assignments
  • POST /assignments - Create assignment (instructor)
  • POST /assignments/:id/submit - Submit assignment (student)

Admin:

  • GET /users - List all users (admin)
  • DELETE /users/:id - Delete user (admin)
  • GET /users/admin/stats - Platform statistics (admin)

Chat:

  • GET /chat/:courseId - Get course messages
  • POST /chat/:courseId - Send message

See full documentation for request/response formats and authentication requirements.

๐Ÿงช Testing

Run All Tests

From project root:

npm test

Backend Tests

cd server
npm test

Test Coverage:

  • Authentication routes (register, login, logout)
  • JWT token validation
  • Role-based access control
  • Input validation

Frontend Tests

cd client
npm test

Test Coverage:

  • Login component rendering
  • Form validation
  • User interactions

Watch Mode (for development)

# Backend
cd server
npm run test:watch

# Frontend
cd client
npm test -- --watch

๐Ÿšข Deployment

Option 1: Deploy to Render (Backend) + Vercel (Frontend)

Backend on Render

  1. Create account on Render
  2. Click "New +" โ†’ "Web Service"
  3. Connect your GitHub repository
  4. Configure:
    • Build Command: cd server && npm install
    • Start Command: node server/index.js
    • Environment: Add all variables from server/.env.example
  5. Deploy

Frontend on Vercel

  1. Create account on Vercel
  2. Import your GitHub repository
  3. Configure:
    • Root Directory: client
    • Build Command: npm run build
    • Output Directory: dist
    • Environment Variables: Add from client/.env.example
  4. Update VITE_API_URL to your Render backend URL
  5. Deploy

Option 2: Deploy to Heroku

  1. Install Heroku CLI
  2. Create Heroku app:
   heroku create edunexus
  1. Add MongoDB addon:
   heroku addons:create mongolab:sandbox
  1. Set environment variables:
   heroku config:set JWT_SECRET=your_secret
   heroku config:set CLIENT_URL=https://your-frontend-url.com
  1. Deploy:
   git push heroku main

Option 3: Docker Deployment

Create docker-compose.yml:

version: '3.8'
services:
  mongodb:
    image: mongo:6
    ports:
      - "27017:27017"
    volumes:
      - mongo-data:/data/db
  
  backend:
    build: ./server
    ports:
      - "5000:5000"
    environment:
      - MONGO_URI=mongodb://mongodb:27017/edunexus
      - JWT_SECRET=${JWT_SECRET}
    depends_on:
      - mongodb
  
  frontend:
    build: ./client
    ports:
      - "3000:3000"
    environment:
      - VITE_API_URL=http://localhost:5000/api

volumes:
  mongo-data:

Deploy:

docker-compose up -d

Environment Variables for Production

Critical Security Settings:

  • Set NODE_ENV=production
  • Use strong, random JWT_SECRET
  • Update CLIENT_URL to your frontend domain
  • Use MongoDB Atlas or managed database
  • Enable HTTPS
  • Configure proper CORS origins

๐Ÿ“ Project Structure

edunexus/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml              # GitHub Actions CI/CD
โ”œโ”€โ”€ server/                     # Backend application
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ db.js              # Database configuration
โ”‚   โ”œโ”€โ”€ controllers/           # Route controllers
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js
โ”‚   โ”‚   โ”œโ”€โ”€ courseController.js
โ”‚   โ”‚   โ”œโ”€โ”€ assignmentController.js
โ”‚   โ”‚   โ”œโ”€โ”€ userController.js
โ”‚   โ”‚   โ””โ”€โ”€ chatController.js
โ”‚   โ”œโ”€โ”€ middleware/            # Custom middleware
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js           # JWT authentication
โ”‚   โ”‚   โ”œโ”€โ”€ roleCheck.js      # Role-based access
โ”‚   โ”‚   โ””โ”€โ”€ upload.js         # File upload handling
โ”‚   โ”œโ”€โ”€ models/               # Mongoose models
โ”‚   โ”‚   โ”œโ”€โ”€ User.js
โ”‚   โ”‚   โ”œโ”€โ”€ Course.js
โ”‚   โ”‚   โ”œโ”€โ”€ Assignment.js
โ”‚   โ”‚   โ”œโ”€โ”€ Submission.js
โ”‚   โ”‚   โ””โ”€โ”€ Message.js
โ”‚   โ”œโ”€โ”€ routes/               # API routes
โ”‚   โ”‚   โ”œโ”€โ”€ authRoutes.js
โ”‚   โ”‚   โ”œโ”€โ”€ courseRoutes.js
โ”‚   โ”‚   โ”œโ”€โ”€ assignmentRoutes.js
โ”‚   โ”‚   โ”œโ”€โ”€ userRoutes.js
โ”‚   โ”‚   โ””โ”€โ”€ chatRoutes.js
โ”‚   โ”œโ”€โ”€ services/             # Business logic
โ”‚   โ”‚   โ””โ”€โ”€ uploadService.js
โ”‚   โ”œโ”€โ”€ utils/                # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ validation.js
โ”‚   โ”‚   โ””โ”€โ”€ logger.js
โ”‚   โ”œโ”€โ”€ tests/                # Backend tests
โ”‚   โ”‚   โ””โ”€โ”€ auth.test.js
โ”‚   โ”œโ”€โ”€ seed.js               # Database seeder
โ”‚   โ”œโ”€โ”€ index.js              # Server entry point
โ”‚   โ”œโ”€โ”€ socket.js             # Socket.io configuration
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ client/                    # Frontend application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth/        # Authentication components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ courses/     # Course components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ assignments/ # Assignment components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ chat/        # Chat components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ admin/       # Admin components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/   # Dashboard components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ layout/      # Layout components
โ”‚   โ”‚   โ”œโ”€โ”€ context/         # React context
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/           # Custom hooks
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ useAuth.js
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # API services
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api.js
โ”‚   โ”‚   โ”œโ”€โ”€ tests/           # Frontend tests
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ setup.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Login.test.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx          # Main App component
โ”‚   โ”‚   โ”œโ”€โ”€ main.jsx         # Entry point
โ”‚   โ”‚   โ””โ”€โ”€ index.css        # Global styles
โ”‚   โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ”œโ”€โ”€ tailwind.config.js
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ API.md                # API documentation
โ”œโ”€โ”€ uploads/                  # Local file storage
โ”‚   โ”œโ”€โ”€ videos/
โ”‚   โ””โ”€โ”€ assignments/
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ ASSUMPTIONS.md            # Development assumptions
โ”œโ”€โ”€ README.md                 # This file
โ”œโ”€โ”€ Procfile                  # Heroku deployment
โ””โ”€โ”€ package.json              # Root package.json

๐Ÿ“ธ Screenshots

Login Page

Clean and simple authentication interface with demo credentials displayed.

Student Dashboard

Overview of enrolled courses, assignments, and progress tracking.

Instructor Dashboard

Manage courses, view enrolled students, and track submissions.

Course Detail Page

View lectures, assignments, and access course chat.

Admin Dashboard

Platform statistics and user/content management tools.

Real-time Chat

Course-specific chat with typing indicators and message history.

(Add actual screenshots here)

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

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

Development Guidelines

  • Follow existing code style and conventions
  • Write tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR
  • Use meaningful commit messages

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Project Specification: FullStackProject-Sem3_33099103.pdf
  • Built as part of Full Stack Development coursework (Semester 3)
  • Inspired by modern LMS platforms like Moodle, Canvas, and Udemy
  • Special thanks to the MERN stack community

๐Ÿ“ž Support & Contact

For issues, questions, or suggestions:

๐Ÿ”ฎ Future Enhancements

Potential features for future versions:

  • Email verification for registration
  • Password reset functionality
  • Course progress tracking with completion percentages
  • Certificate generation upon course completion
  • Payment integration for paid courses
  • Advanced analytics dashboard
  • Video upload directly from UI (not just URL)
  • Assignment grading interface for instructors
  • Live video classes integration (Zoom/Google Meet)
  • Mobile app (React Native)
  • Course reviews and ratings
  • Discussion forums per course
  • Push notifications
  • Calendar integration for assignment due dates
  • Bulk user import (CSV)
  • Course categories and tags

โš ๏ธ Important Notes

  • Security: This is an educational project. For production use, implement additional security measures:

    • Rate limiting on all endpoints
    • Input sanitization and XSS protection
    • CSRF protection
    • Helmet.js security headers
    • SQL injection prevention (N/A for MongoDB, but be aware)
    • Regular security audits
  • Performance: Consider implementing:

    • Redis caching for frequent queries
    • Database indexing optimization
    • CDN for static assets
    • Load balancing for scalability
  • Monitoring: Add monitoring tools:

    • Error tracking (Sentry)
    • Performance monitoring (New Relic)
    • Logging service (Winston + ELK stack)

Last Updated: October 26, 2025

Releases

No releases published

Packages

 
 
 

Contributors

Languages