A production-style microservices architecture built using Spring Boot, Spring Cloud, and JWT-based security, designed to manage employees and their addresses with secure, scalable, and maintainable service communication.
This project demonstrates a fully decoupled microservices system with:
- 🔐 Secure authentication using JWT
- 🌐 Centralized API Gateway
- 📡 Service discovery with Eureka
- ⚙️ Shared exception handling via Common Library
- 🔁 Inter-service communication using Feign Client
Client → API Gateway → (Auth / Employee / Address Services)
↓
Eureka Server
↓
Common Library
- Entry point for all client requests
- Handles routing to appropriate services
- Performs JWT validation and authorization
- Filters public and secured endpoints
- User registration & login
- Generates JWT access tokens
- Implements role-based authorization
- Provides token validation endpoint
-
CRUD operations for employees:
- Create
- Update
- Get
- Delete
-
Communicates with Address Service via Feign
-
Manages employee address data:
- Create
- Update
- Get
- Delete
-
Linked with Employee Service
- Service registry and discovery
- Enables dynamic service communication
- Eliminates hardcoded service URLs
- Centralized exception handling
- Shared DTOs and response models
- Ensures consistent error response across all services
-
User registers/logs in via Auth Service
-
Receives a JWT token
-
Sends token in request headers:
Authorization: Bearer <token> -
API Gateway:
- Validates token
- Allows/blocks access based on endpoint
- Java 25 & 21
- Spring Boot
- Java Persistent API (JPA)
- Spring Cloud (Gateway, Eureka)
- Spring Security
- JWT (JSON Web Token)
- Feign Client
- Lombok
- MySQL
- ✅ Microservices-based architecture
- ✅ Centralized API Gateway
- ✅ JWT Authentication & Authorization
- ✅ Role-based access control
- ✅ Service Discovery (Eureka)
- ✅ Inter-service communication (Feign)
- ✅ Global Exception Handling (Common Library)
employee-management/
│
├── api-gateway/
├── auth-service/
├── employee-service/
├── address-service/
├── common-library/
├── eureka-server/
-
Start Eureka Server
-
Start all microservices:
- Auth Service
- Employee Service
- Address Service
-
Start API Gateway
-
Access APIs via Gateway
-
Register user →
/api/auth/register -
Login →
/api/auth/login -
Get JWT token
-
Call secured APIs:
/api/employees/api/addresses
-
All services use Common Library
-
Standard error response format:
{ "message": "Error message", "status": 404, "timestamp": "..." } -
Feign client handles remote service errors via custom decoder
Md. Nazmul Hasan Anik Former Associate Software Engineer at NextKraft Ltd
Give it a ⭐ on this project.