A production-ready RESTful API for a Learning Management System (LMS), built with Node.js, Express, and MongoDB.
Supports user roles (students, instructors), course & lecture management, secure enrollment, and JWT-based authentication.
- User authentication & authorization (JWT, role-based access)
- Course & Lecture management: create, update, delete, publish
- Enrollment management: students enroll in courses and access their lectures
- Schema validation & data integrity via Mongoose models
- Environment-based configuration (development / production)
- Utilities & helpers for cleaner, reusable code (
utils/) - Structured folder layout: controllers, routes, models, config, utils
- Error handling: centralized middleware with custom error classes
| Package | Purpose |
|---|---|
express |
Web framework for routing and middleware |
mongoose |
MongoDB object modeling and schema enforcement |
dotenv |
Load configuration via environment variables |
jsonwebtoken |
Token-based authentication |
bcrypt |
Secure password hashing |
express-validator |
Request body / parameter validation |
helmet |
Security headers |
morgan |
HTTP request logging |
cors |
Handle cross-origin requests |
- Node.js (v16+ recommended)
- npm or yarn
- MongoDB (local or Atlas)
- (Optional) Postman / REST client for testing
# Clone the repository
git clone https://github.com/subhaushsingh/LMS.git
cd LMS
# Install dependencies
npm installCreate a .env file in the root directory with the following variables:
# Server
PORT=8000
NODE_ENV=development
CLIENT_URL=http://localhost:5173
# MongoDB
MONGODB_URL=your_mongodb_connection_string
# JWT Secret
SECRET_KEY=your_secret_key
# Cloudinary (optional)
CLOUDINARY_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
# Razorpay (optional)
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret