A production-style Microservices-based Leave Management System developed using Java, Spring Boot, Spring Cloud, Docker, MySQL, and JWT Authentication.
The application enables employees to apply for leave, managers to approve or reject leave requests, and automatically updates employee leave balances after approval. The project follows modern microservices architecture using Spring Cloud components such as Config Server, Eureka Service Discovery, API Gateway, and OpenFeign.
This project was built to demonstrate enterprise-level backend development practices including distributed architecture, centralized configuration, service discovery, secure authentication, inter-service communication, Docker deployment, and clean layered architecture.
- Overview
- Features
- Architecture
- Microservices
- Technology Stack
- Project Structure
- System Workflow
- Getting Started
- Prerequisites
- Installation
- Configuration
- Running the Project
- API Endpoints
- Authentication
- Docker Support
- Future Enhancements
- Screenshots
- Author
The Leave Management System is designed to simplify employee leave management by automating the complete leave approval workflow.
Employees can:
- Login securely
- Apply for leave
- View leave history
- Track leave status
Managers can:
- View pending leave requests
- Approve or reject leave requests
- Automatically deduct employee leave balance after approval
The application follows a distributed microservices architecture where each service has a single responsibility.
- JWT Authentication
- Role-based Authorization
- Secure Login
- Password Encryption
- Employee Registration
- Employee Login
- Employee Details
- Leave Balance Management
- Apply Leave
- View Leave Requests
- Leave Approval
- Leave Rejection
- Automatic Leave Balance Deduction
- Spring Boot Microservices
- API Gateway
- Eureka Service Discovery
- Spring Cloud Config Server
- OpenFeign Communication
- Global Exception Handling
- Validation
- Centralized Configuration
- Dockerized Deployment
Client
|
|
API Gateway
|
----------------------------------------
| | | |
Auth Service Employee Service Leave Service Notification Service
|
MySQL Database
Eureka Server
^
|
All Services Registered
Config Server
^
|
Configuration for all Services
Responsibilities
- Single Entry Point
- Routing Requests
- JWT Validation
- Security
Responsibilities
- Centralized Configuration
- Environment-based Properties
Responsibilities
- Service Discovery
- Dynamic Registration
Responsibilities
- User Authentication
- JWT Token Generation
- Login Validation
Responsibilities
- Employee CRUD
- Leave Balance
- Employee Information
Responsibilities
- Apply Leave
- Approve Leave
- Reject Leave
- Leave Status
- Business Logic
Responsibilities
- Notification APIs
- Email (Future Scope)
- Java 21
- Spring Boot 3
- Spring Security
- Spring Data JPA
- Spring Validation
- Eureka Server
- Spring Cloud Gateway
- Spring Cloud Config
- OpenFeign
- MySQL
- JWT
- Maven
- Docker
- Docker Compose
- Swagger/OpenAPI
leave-management-system
│
├── api-gateway
├── auth-service
├── config-server
├── eureka-server
├── employee-service
├── leave-service
├── notification-service
├── common-library
├── docker-compose.yml
├── pom.xml
└── README.md
Employee
↓
API Gateway
↓
Auth Service
↓
JWT Token Generated
↓
Token Returned
Employee
↓
API Gateway
↓
Leave Service
↓
Leave Request Saved
↓
Pending Manager Approval
Manager
↓
API Gateway
↓
Leave Service
↓
Employee Service
↓
Leave Balance Updated
↓
Leave Status = APPROVED
Before running the project, ensure the following software is installed:
- Java 21
- Maven 3.9+
- Docker
- Docker Compose
- MySQL
- Git
git clone https://github.com/yourusername/leave-management-system.git
cd leave-management-systemmvn clean installRun in the following order:
-
Config Server
-
Eureka Server
-
Auth Service
-
Employee Service
-
Leave Service
-
Notification Service
-
API Gateway
Update your application-local.yml or application.yml with your database credentials.
Example:
spring:
datasource:
url: jdbc:mysql://localhost:3306/leave_management
username: root
password: passwordBuild Docker Images
docker compose buildRun Containers
docker compose upStop Containers
docker compose downThe application uses JWT Authentication.
Typical Flow
-
Login
-
Receive JWT Token
-
Add JWT Token in Authorization Header
Authorization: Bearer <JWT_TOKEN>
POST /api/auth/login
POST /api/auth/register
GET /api/employees
GET /api/employees/{id}
POST /api/employees
POST /api/leaves
GET /api/leaves
PUT /api/leaves/{id}/approve
PUT /api/leaves/{id}/reject
The project includes centralized exception handling for:
- Resource Not Found
- Validation Errors
- Unauthorized Access
- Business Exceptions
- Internal Server Errors
- Spring Security
- JWT Authentication
- Password Encryption
- Protected APIs
- Role-Based Access
You can run all unit tests using:
mvn test- Email Notifications
- Leave Cancellation
- Holiday Calendar
- Manager Dashboard
- Admin Dashboard
- File Attachments
- Audit Logging
- Kafka Event Messaging
- Redis Caching
- Kubernetes Deployment
- CI/CD Pipeline
- Monitoring using Prometheus & Grafana
Add screenshots here.
Example:
docs/images/login.png
docs/images/dashboard.png
docs/images/swagger.png
This project demonstrates practical experience with:
- Java
- Spring Boot
- Spring Security
- Spring Cloud
- Microservices
- REST APIs
- OpenFeign
- JWT
- MySQL
- Docker
- Maven
- Exception Handling
- Layered Architecture
- Distributed Systems
- Service Discovery
- API Gateway
- Config Server
Akshat Bhawsar
Java Backend Developer
If you found this project helpful, consider giving it a ⭐ on GitHub.