A comprehensive microservices architecture implementation using Spring Boot, Spring Cloud, and related technologies.
This project demonstrates a complete microservices ecosystem with service discovery, configuration management, API gateway, distributed tracing, and inter-service communication.
- Employee Service - Manages employee information and operations
- Employee Payroll Service - Handles payroll calculations and management
- Role Service - Manages user roles and permissions
- Eureka Naming Server - Service discovery and registration
- Spring Cloud Config Server - Centralized configuration management
- Zuul Edge Server - API gateway for routing and load balancing
- Zipkin Tracing - Distributed tracing and monitoring
- Java 11 or higher
- Spring Boot 2.7.18
- Spring Cloud 2021.0.8
- Maven - Build tool and dependency management
- H2 Database - In-memory database for development
- Netflix Eureka - Service discovery
- Zuul - API gateway
- Zipkin - Distributed tracing
- OpenFeign - HTTP client for inter-service communication
msa/
|-- pom.xml # Parent POM with common configuration
|-- README.md # This file
|-- docs/ # Documentation
| |-- project-overview.md # Architecture overview
| |-- development-guide.md # Build, run, test procedures
| |-- api-reference.md # API documentation
| `-- working-project-summary.md # Project status
|-- employee-payroll-service/ # Payroll management service
|-- employee-service/ # Employee management service
|-- eureka-naming-server/ # Service discovery server
|-- role-service/ # Role management service
|-- spring-cloud-config-server/ # Configuration server
|-- zipkin-tracing/ # Distributed tracing server
`-- zuul-edge-server/ # API gateway
- Java 11 or higher
- Maven 3.3 or higher
git clone https://github.com/RaviGit18/msa.git
cd msa# Build all modules
mvn clean install
# Skip tests for faster build
mvn clean install -DskipTests
# Build specific module
mvn clean install -pl employee-service
-
Start Infrastructure Services (in order):
# Start Eureka Server cd eureka-naming-server java -jar target/eureka-naming-server-0.0.1-SNAPSHOT.jar # Start Config Server cd ../spring-cloud-config-server java -jar target/spring-cloud-config-server-0.0.1-SNAPSHOT.jar # Start Zipkin (optional) cd ../zipkin-tracing java -jar target/zipkin-tracing-0.0.1-SNAPSHOT.jar
-
Start Business Services:
# Start Role Service cd ../role-service java -jar target/role-service-0.0.1-SNAPSHOT.jar # Start Employee Service cd ../employee-service java -jar target/employee-service-0.0.1-SNAPSHOT.jar # Start Payroll Service cd ../employee-payroll-service java -jar target/employee-payroll-service-0.0.1-SNAPSHOT.jar
-
Start Gateway:
cd ../zuul-edge-server java -jar target/zuul-edge-server-0.0.1-SNAPSHOT.jar
Once all services are running, you can access:
- Eureka Dashboard: http://localhost:8761
- Zuul Gateway: http://localhost:9090
- Zipkin Dashboard: http://localhost:9411
- Config Server: http://localhost:8888
# Test Role Service
curl http://localhost:8082/role/DEV
# Test Employee Service
curl http://localhost:8080/employee/1000
# Test Payroll Service
curl -X POST http://localhost:8081/employee/1000/role/DEV
# Test through Gateway
curl http://localhost:9090/role-service/role/DEVAll services use Spring Cloud Config for centralized configuration. Configuration files are located in the spring-cloud-config-server module.
Services use H2 in-memory database by default. The database console is available at:
- Employee Service: http://localhost:8080/h2-console
- Payroll Service: http://localhost:8081/h2-console
- Role Service: http://localhost:8082/h2-console
Default credentials:
- URL:
jdbc:h2:mem:testdb - Username:
sa - Password: (empty)
# Run all tests
mvn test
# Run tests for specific module
mvn test -pl role-service
# Run integration tests
mvn verify- Zipkin provides distributed tracing across microservices
- Spring Boot Actuator endpoints expose health and metrics information
- Eureka provides service discovery and health monitoring
Each service exposes RESTful APIs. You can explore the APIs using:
- Swagger UI (if configured)
- Direct HTTP requests
- See
docs/api-reference.mdfor complete API documentation
Complete documentation is available in the docs/ directory:
- project-overview.md: Architecture and setup information
- development-guide.md: Build, run, and test procedures
- api-reference.md: Complete API documentation
- working-project-summary.md: Project status and quick start
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
This project is for educational and demonstration purposes.
For questions or issues, please refer to the documentation or create an issue in the repository.
This repository uses a monorepo structure where all microservices are included as local directories (not Git submodules). This makes it easy to:
- Clone and build the entire project with a single command
- Navigate between services easily
- Maintain consistent versions across all services
- Test inter-service communication locally