Skip to content

N1CK99925/Learning-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

114 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Learning Management System (LMS)

A comprehensive full-stack Learning Management System built with Spring Boot and React, featuring course management, student enrollment, real-time updates, rate limiting, and containerized deployment.

πŸ“‹ Features

Student Features

  • User authentication and registration
  • Browse and search available courses
  • View detailed course information
  • Enroll in courses (with seat availability checking)
  • View enrolled courses and progress
  • Drop courses
  • Prevent duplicate enrollments
  • Student dashboard with personalized course information

Admin Features

  • Create, update, and delete courses
  • Activate/deactivate courses
  • Manage course capacity and details
  • View comprehensive enrollment statistics
  • Promote users to admin role
  • View system dashboard with key metrics
  • Manage student accounts and profiles

πŸš€ Technology Stack

Backend

  • Framework: Spring Boot 4.0.1
  • Java Version: 21 (LTS)
  • Security: Spring Security with JWT Token Authentication
  • Database: PostgreSQL with Spring Data JPA / Hibernate
  • Rate Limiting: Bucket4j with Redis support
  • Validation: Jakarta Bean Validation
  • Cache: Redis (for rate limiting and caching)
  • Build Tool: Maven 3.6+
  • Monitoring: Spring Boot Actuator
  • Containerization: Docker with health checks

Frontend

  • Framework: React 19.2.3 with Vite 7.3.1
  • Routing: React Router 7.12.0
  • Styling: Tailwind CSS 3.4.17 with PostCSS
  • Icons: Lucide React 0.562
  • HTTP Client: Axios
  • Code Quality: ESLint with React hooks support
  • Node Version: 18+

Infrastructure

  • Container Orchestration: Docker Compose 3.8
  • Services: Frontend (Nginx), Backend (Spring Boot), Redis
  • Networking: Custom bridge network
  • Health Checks: Configured for all services
  • Volume Management: Persistent storage for Redis and file uploads

πŸ“ Project Structure

Learning-Management-System/
β”œβ”€β”€ lms/                           # Backend (Spring Boot)
β”‚   β”œβ”€β”€ src/main/java/lms/lms/
β”‚   β”‚   β”œβ”€β”€ config/                # Security, Web, and Rate Limit Configuration
β”‚   β”‚   β”œβ”€β”€ controller/            # REST API Controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthController
β”‚   β”‚   β”‚   β”œβ”€β”€ StudentController
β”‚   β”‚   β”‚   └── AdminController
β”‚   β”‚   β”œβ”€β”€ dto/                   # Data Transfer Objects
β”‚   β”‚   β”œβ”€β”€ entity/                # JPA Entities (User, Course, Enrollment, etc.)
β”‚   β”‚   β”œβ”€β”€ exception/             # Custom Exceptions and Global Exception Handler
β”‚   β”‚   β”œβ”€β”€ repository/            # JPA Repositories
β”‚   β”‚   β”œβ”€β”€ security/              # JWT Token Service and Security Filters
β”‚   β”‚   └── service/               # Business Logic Layer
β”‚   β”œβ”€β”€ src/main/resources/
β”‚   β”‚   β”œβ”€β”€ application.properties
β”‚   β”‚   β”œβ”€β”€ application-dev.properties
β”‚   β”‚   └── example.application.properties
β”‚   β”œβ”€β”€ pom.xml                    # Maven Dependencies
β”‚   β”œβ”€β”€ Dockerfile                 # Backend Container Configuration
β”‚   └── mvnw/mvnw.cmd              # Maven Wrapper
β”‚
β”œβ”€β”€ frontend/lms/                  # Frontend (React + Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/            # React Components
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SidebarH.jsx
β”‚   β”‚   β”‚   └── TopNavbar.jsx
β”‚   β”‚   β”œβ”€β”€ pages/                 # Page Components
β”‚   β”‚   β”‚   β”œβ”€β”€ LandingPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LoginPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RegisterPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CourseCatalog.jsx
β”‚   β”‚   β”‚   └── StudentDashboard.jsx
β”‚   β”‚   β”œβ”€β”€ context/               # React Context (Authentication State)
β”‚   β”‚   β”‚   └── AuthContext.jsx
β”‚   β”‚   β”œβ”€β”€ layouts/               # Layout Components
β”‚   β”‚   β”‚   └── DashboardLayout.jsx
β”‚   β”‚   β”œβ”€β”€ api/                   # API Configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ axios.js           # Axios instance
β”‚   β”‚   β”‚   └── CourseApi.js       # Course API calls
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ main.jsx
β”‚   β”‚   β”œβ”€β”€ index.css
β”‚   β”‚   └── App.css
β”‚   β”œβ”€β”€ public/                    # Static assets
β”‚   β”œβ”€β”€ package.json               # NPM Dependencies
β”‚   β”œβ”€β”€ vite.config.js             # Vite Configuration
β”‚   β”œβ”€β”€ tailwind.config.js         # Tailwind CSS Configuration
β”‚   β”œβ”€β”€ postcss.config.js          # PostCSS Configuration
β”‚   β”œβ”€β”€ eslint.config.js           # ESLint Configuration
β”‚   β”œβ”€β”€ nginx.conf                 # Nginx Configuration for production
β”‚   β”œβ”€β”€ Dockerfile                 # Frontend Container Configuration
β”‚   └── README.md                  # Frontend Documentation
β”‚
β”œβ”€β”€ Docker-Compose.yml             # Multi-container orchestration
└── Readme.md                      # This file

πŸ”§ Setup Instructions

Prerequisites

For Local Development

  • Java: 21 or higher (OpenJDK or Oracle JDK)
  • Maven: 3.6+ (or use bundled mvnw)
  • Node.js: 18+ with npm
  • PostgreSQL: 12+ (local or managed service)
  • Redis: 6+ (local or managed service)
  • Docker: (Optional, for containerized deployment)
  • Docker Compose: 2.0+ (if using Docker)

Database Setup

Option 1: PostgreSQL Locally

  1. Create a PostgreSQL database:
CREATE DATABASE lms_db;
  1. Configure connection in lms/src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/lms_db
spring.datasource.username=postgres
spring.datasource.password=your_password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update

Option 2: Using Docker Compose (Recommended)

The Docker Compose setup includes PostgreSQL configuration via environment variables.

Running the Application

Option 1: Local Development (Native)

Backend Setup:

cd lms

# Build the project
mvn clean install

# Run the application
mvn spring-boot:run

The backend will start on http://localhost:8080

Frontend Setup:

cd frontend/lms

# Install dependencies
npm install

# Start development server
npm run dev

The frontend will start on http://localhost:5173 (Vite default)

Option 2: Docker Compose Deployment (Recommended)

  1. Clone the repository:
git clone <repository-url>
cd Learning-Management-System
  1. Configure environment variables:
cp .env.example .env
# Edit .env with your configuration
  1. Start all services:
docker-compose up -d

Access the application:

  • Frontend: http://localhost:3000
  • Backend API: http://localhost:8080
  • Redis: localhost:6379

Building for Production

Backend:

cd lms
mvn clean package -DskipTests
java -jar target/lms-0.0.1-SNAPSHOT.jar

Frontend:

cd frontend/lms
npm run build
npm run preview

πŸ“‘ API Endpoints

Authentication Endpoints (/api/auth)

Register New User

POST /api/auth/register
Content-Type: application/json

{
  "username": "john_doe",
  "email": "john@example.com",
  "password": "SecurePassword123!"
}

Response:

{
  "id": 1,
  "username": "john_doe",
  "email": "john@example.com",
  "role": "STUDENT"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "username": "john_doe",
  "password": "SecurePassword123!"
}

Response:

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 86400000,
  "user": {
    "id": 1,
    "username": "john_doe",
    "email": "john@example.com",
    "role": "STUDENT"
  }
}

Validate Token

GET /api/auth/validate
Authorization: Bearer {token}

Get Current User

GET /api/auth/me
Authorization: Bearer {token}

Student Endpoints (/api/student)

All student endpoints require Authorization: Bearer {token} header with STUDENT role.

Get Available Courses

GET /api/student/courses

Get Course Details

GET /api/student/courses/{id}

Enroll in Course

POST /api/student/enroll/{courseId}

Request Body:

{
  "courseId": 1
}

Drop Course

POST /api/student/drop/{courseId}

Get My Enrollments

GET /api/student/enrollments

Get Active Enrollments

GET /api/student/enrollments/active

Admin Endpoints (/api/admin)

All admin endpoints require Authorization: Bearer {token} header with ADMIN role.

Get All Courses

GET /api/admin/courses

Create Course

POST /api/admin/courses
Content-Type: application/json

{
  "title": "Advanced Java",
  "description": "Learn advanced Java concepts",
  "instructor": "Dr. Smith",
  "capacity": 30,
  "credits": 3
}

Update Course

PUT /api/admin/courses/{id}
Content-Type: application/json

{
  "title": "Advanced Java",
  "description": "Updated description",
  "capacity": 40,
  "isActive": true
}

Delete Course

DELETE /api/admin/courses/{id}

Get All Students

GET /api/admin/students

Get Enrollments

GET /api/admin/enrollments

Get Dashboard Statistics

GET /api/admin/dashboard/stats

Response:

{
  "totalStudents": 150,
  "totalCourses": 25,
  "activeEnrollments": 450,
  "totalEnrollments": 500
}

πŸ” Security

JWT Authentication

  • Tokens expire after 24 hours (configurable)
  • Tokens include user ID, username, and role
  • All protected endpoints require valid JWT token in Authorization header
  • Format: Authorization: Bearer {token}

Rate Limiting

  • Implemented using Bucket4j with Redis backend
  • Prevents API abuse with per-user request limits
  • Configurable rate limits per endpoint

Password Security

  • Passwords are hashed using Spring Security's BCrypt
  • Passwords require minimum strength validation
  • Never transmitted in responses

πŸ—οΈ Docker Configuration

Services

Frontend Service

  • Container: lms-frontend
  • Port: 3000:80
  • Base Image: Node.js 20 LTS
  • Build: Uses multi-stage build for optimization
  • Web Server: Nginx reverse proxy

Backend Service

  • Container: lms-app
  • Port: 8080:8080
  • Base Image: Eclipse Temurin JDK 21
  • Health Check: Actuator endpoint monitoring
  • Environment: Configured via .env file
  • Volumes: Persistent upload storage

Redis Service

  • Container: lms-redis
  • Port: 6379:6379
  • Image: redis:7-alpine
  • Persistence: AOF (Append Only File)
  • Health Check: Redis CLI ping

Environment Variables

Create a .env file in the project root:

# Database
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/lms_db
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=your_secure_password

# JWT
JWT_SECRET=your_jwt_secret_key_here
JWT_EXPIRATION=86400000

# Redis
SPRING_DATA_REDIS_PASSWORD=your_redis_password

# File Upload
MAX_FILE_SIZE=10MB
MAX_REQUEST_SIZE=10MB

# JVM
JAVA_OPTS=-Xmx512m -Xms256m

# Spring Profile
SPRING_PROFILES_ACTIVE=dev

πŸ§ͺ Testing

Backend Tests

cd lms
mvn test

Frontend Tests

cd frontend/lms
npm run lint

πŸ“Š Project Statistics

  • Backend Lines of Code: Java Spring Boot application with comprehensive REST API
  • Frontend Components: ~5 main page components with protected routing
  • Database Tables: User, Course, Enrollment entities with proper relationships
  • API Endpoints: 20+ RESTful endpoints for student, admin, and authentication operations
  • Deployment: Full containerized deployment with health checks and monitoring

πŸš€ Performance Optimization

Backend

  • Connection pooling for database
  • Redis caching for rate limiting
  • JPA query optimization
  • Actuator for performance monitoring
  • Configurable JVM heap size

Frontend

  • Vite for fast development and optimized builds
  • React 19 with latest performance features
  • Tailwind CSS for minimal CSS output
  • Router-based code splitting
  • ESLint for code quality

🀝 Contributing

  1. Create a feature branch
  2. Make your changes
  3. Run tests locally
  4. Submit a pull request

πŸ“ Development Tips

Backend Development

  • Use application-dev.properties for local development
  • Enable detailed logging with logging.level.root=DEBUG
  • Swagger/Springdoc can be added for API documentation

Frontend Development

  • Use npm run dev for hot module replacement (HMR)
  • Check console for ESLint warnings
  • Tailwind CSS IntelliSense extension recommended for VS Code

πŸ› Troubleshooting

Docker Issues

# View logs
docker-compose logs -f app
docker-compose logs -f frontend
docker-compose logs -f redis

# Restart services
docker-compose restart

# Reset everything
docker-compose down -v
docker-compose up -d

Database Connection Issues

  • Ensure PostgreSQL is running and accessible
  • Check credentials in .env or application.properties
  • Verify database exists: CREATE DATABASE lms_db;

Redis Connection Issues

  • Verify Redis is running on port 6379
  • Check Redis health: redis-cli ping
  • Ensure Spring Redis configuration is correct

Frontend Build Issues

cd frontend/lms
rm -rf node_modules package-lock.json
npm install
npm run build

πŸ“š Additional Resources

πŸ“„ License

This project is provided as-is for educational and development purposes.

πŸ‘₯ Support

For issues, questions, or improvements, please refer to the project documentation or create an issue in the repository.


Last Updated: March 5, 2026
Project Version: 0.0.1-SNAPSHOT
Java Version: 21 LTS
Spring Boot: 4.0.1
React: 19.2.3

About

Learning Management System (LMS) A web-based application for managing courses, students, and learning materials. Admins can create courses and upload resources, while students can enroll and access materials. Built with Spring Boot, Java, Thymeleaf, and PostgreSQL, it provides role-based authentication and a modular backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors