A full-stack MERN application for online learning with course management, video lectures, assignments, and real-time chat.
- Features
- Tech Stack
- Prerequisites
- Installation
- Environment Setup
- Running the Application
- Demo Credentials
- API Documentation
- Testing
- Deployment
- Project Structure
- Screenshots
- Contributing
- โ 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
- Student: Enroll in courses, watch lectures, submit assignments, participate in chat
- Instructor: Create/manage courses, upload lectures/assignments, view submissions
- Admin: Full platform oversight, user management, content moderation
- 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
- 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
- Jest & Supertest - Backend testing
- Vitest & React Testing Library - Frontend testing
- GitHub Actions - CI/CD pipeline
- ESLint & Prettier - Code quality
Before you begin, ensure you have the following installed:
- Node.js >= 18.x (Download)
- npm >= 9.x (comes with Node.js)
- MongoDB >= 6.x (Download) or MongoDB Atlas account
- Git (Download)
git clone https://github.com/yourusername/edunexus.git
cd edunexuscd server
npm installcd ../client
npm installAlternatively, install all dependencies at once from the root:
npm run install:allCreate 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=5Create client/.env from client/.env.example:
VITE_API_URL=http://localhost:5000/api
VITE_SOCKET_URL=http://localhost:5000- Never commit
.envfiles 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
If using local MongoDB:
mongodIf using MongoDB Atlas:
Update MONGO_URI in server/.env with your connection string.
cd server
npm run seedThis creates:
- 1 Admin user
- 1 Instructor user
- 2 Student users
- 3 Sample courses with lectures
- 1 Sample assignment
- Sample chat messages
cd server
npm run devBackend will run on http://localhost:5000
Open a new terminal:
cd client
npm run devFrontend will run on http://localhost:5173
From the project root:
npm run devBackend:
cd server
npm startFrontend (build and preview):
cd client
npm run build
npm run previewAfter running the seed script, use these credentials to explore different roles:
| Role | 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 |
Detailed API documentation is available in docs/API.md
Base URL: http://localhost:5000/api
Authentication:
POST /auth/register- Register new userPOST /auth/login- LoginPOST /auth/logout- LogoutGET /auth/me- Get current user
Courses:
GET /courses- List all coursesPOST /courses- Create course (instructor)GET /courses/:id- Get course detailsPUT /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 assignmentsPOST /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 messagesPOST /chat/:courseId- Send message
See full documentation for request/response formats and authentication requirements.
From project root:
npm testcd server
npm testTest Coverage:
- Authentication routes (register, login, logout)
- JWT token validation
- Role-based access control
- Input validation
cd client
npm testTest Coverage:
- Login component rendering
- Form validation
- User interactions
# Backend
cd server
npm run test:watch
# Frontend
cd client
npm test -- --watch- Create account on Render
- Click "New +" โ "Web Service"
- Connect your GitHub repository
- Configure:
- Build Command:
cd server && npm install - Start Command:
node server/index.js - Environment: Add all variables from
server/.env.example
- Build Command:
- Deploy
- Create account on Vercel
- Import your GitHub repository
- Configure:
- Root Directory:
client - Build Command:
npm run build - Output Directory:
dist - Environment Variables: Add from
client/.env.example
- Root Directory:
- Update
VITE_API_URLto your Render backend URL - Deploy
- Install Heroku CLI
- Create Heroku app:
heroku create edunexus- Add MongoDB addon:
heroku addons:create mongolab:sandbox- Set environment variables:
heroku config:set JWT_SECRET=your_secret
heroku config:set CLIENT_URL=https://your-frontend-url.com- Deploy:
git push heroku mainCreate 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 -dCritical Security Settings:
- Set
NODE_ENV=production - Use strong, random
JWT_SECRET - Update
CLIENT_URLto your frontend domain - Use MongoDB Atlas or managed database
- Enable HTTPS
- Configure proper CORS origins
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
Clean and simple authentication interface with demo credentials displayed.
Overview of enrolled courses, assignments, and progress tracking.
Manage courses, view enrolled students, and track submissions.
View lectures, assignments, and access course chat.
Platform statistics and user/content management tools.
Course-specific chat with typing indicators and message history.
(Add actual screenshots here)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/AmazingFeature- Commit your changes
git commit -m 'Add some AmazingFeature'- Push to the branch
git push origin feature/AmazingFeature- Open a Pull Request
- 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
This project is licensed under the MIT License - see the LICENSE file for details.
- 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
For issues, questions, or suggestions:
- ๐ง Email: [email protected]
- ๐ Open an issue
- ๐ฌ Discussions
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
-
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