A comprehensive microservices architecture showcase using modern cloud-native technologies
Building resilient, scalable, and observable distributed systems with Spring Boot ecosystem
- 🎯 Overview
- ✨ Key Features
- 🏗️ Architecture
- 🔧 Tech Stack
- 🚀 Quick Start
- 🎛️ Service Discovery & API Access
- 📊 Observability
- 🗃️ Database Management
- 📦 Services Overview
- 💡 Development Tips
- 🤝 Contributing
- 📄 License
This project demonstrates a complete microservices architecture built with Spring Boot, Spring Cloud, and modern cloud-native technologies. It serves as a practical guide for developers looking to understand and implement production-ready distributed systems.
| 🏢 Microservice Architecture
🌱 Spring Boot & Spring Cloud
| 🐳 Containerization
📡 Event-Driven Communication
|
| 📊 Comprehensive Observability
🗄️ Database Diversity
| 🔍 Service Discovery
🛡️ Production Ready
|
This project implements a microservices pattern where different functionalities are broken down into independent services. These services communicate asynchronously via Apache Kafka and are managed through Spring Cloud Gateway and Eureka Service Discovery.
- 🌐 API Gateway as the single entry point
- 📋 Service Registry for dynamic service discovery
- ⚙️ Configuration Server for centralized config management
- 📨 Event-driven communication via Kafka
- 📊 Distributed monitoring and tracing
| Service | Port | Description | Tech Stack |
|---|---|---|---|
| 🌐 API Gateway | 8765 | Single entry point, routing & load balancing | Spring Cloud Gateway |
| 📁 Config Server | 8888 | Centralized configuration management | Spring Cloud Config |
| 🏢 Service Registry | 8761 | Service discovery with Eureka | Spring Cloud Netflix |
| 📚 Catalog Service | 18080 | Product catalog management | PostgreSQL + Liquibase (YAML) |
| 📦 Inventory Service | 18181 | Stock level management | PostgreSQL + Liquibase (JSON) |
| 🛍️ Order Service | 18282 | Order processing & orchestration | PostgreSQL + Liquibase (XML) |
| 💳 Payment Service | 18085 | Payment processing | PostgreSQL + Liquibase (XML) |
| 🛒 Retail Store Web | 8080 | Customer-facing web application | Thymeleaf + Alpine.js |
graph TB UI[🛒 Retail Store WebApp] --> GW[🌐 API Gateway] GW --> CS[📚 Catalog Service] GW --> IS[📦 Inventory Service] GW --> OS[🛍️ Order Service] GW --> PS[💳 Payment Service] OS -.->|Events| Kafka[📡 Kafka] PS -.->|Events| Kafka IS -.->|Events| Kafka SR[🏢 Service Registry] -.->|Discovery| GW SR -.->|Discovery| CS SR -.->|Discovery| IS SR -.->|Discovery| OS SR -.->|Discovery| PS CC[📁 Config Server] -.->|Configuration| GW CC -.->|Configuration| CS CC -.->|Configuration| IS CC -.->|Configuration| OS CC -.->|Configuration| PS style UI fill:#e1f5fe style GW fill:#f3e5f5 style Kafka fill:#fff3e0 style SR fill:#e8f5e8 style CC fill:#fce4ec 🗄️ Data Storage & Management
PostgreSQL
MongoDB
Redis
📋 For complete tech stack details, see techstack.md
Before you begin, ensure you have the following installed:
| Tool | Version | Purpose |
|---|---|---|
| ☕ Java | 21+ | Runtime environment |
| 📦 Maven | 3.9.x+ | Build tool |
| 🐳 Docker | Latest | Containerization |
| 🔧 Docker Compose | Latest | Orchestration |
| 📚 Git | Latest | Version control |
💡 Tip: Ensure
JAVA_HOMEenvironment variable is properly set
-
Clone the repository:
git clone https://github.com/rajadilipkolli/spring-boot-microservices-series-v2.git cd spring-boot-microservices-series-v2 -
Build all modules:
🐧 Linux/macOS:
./mvnw clean install
🪟 Windows:
.\mvnw.cmd clean install
Choose one of the following deployment options:
Perfect for development and basic functionality testing:
docker-compose -f deployment/docker-compose.yml up -d --remove-orphansIncludes Prometheus, Grafana, and other observability tools:
docker-compose -f deployment/docker-compose-tools.yml up -d --remove-orphans🐧 Linux/macOS:
bash run.sh🪟 Windows:
.\start-services.ps1# Stop core services docker-compose -f deployment/docker-compose.yml down # Stop services with monitoring tools docker-compose -f deployment/docker-compose-tools.yml downOnce all services are running, verify the setup:
- 🌐 Service Registry: http://localhost:8761
- 📚 API Documentation: http://localhost:8765/swagger-ui.html
- 🛒 Retail Store App: http://localhost:8080
- 📊 Grafana Dashboard: http://localhost:3000 (user/password)
- 🔍 Zipkin Tracing: http://localhost:9411
Monitor all registered microservices and their health status:
- Dashboard: http://localhost:8761/
- Features: Real-time service health, load balancing, failover
Access all microservice APIs through a unified interface:
- Swagger UI: http://localhost:8765/swagger-ui.html
- Features: API aggregation, rate limiting, authentication
💡 Pro Tip: Use the dropdown menu in Swagger UI to switch between different service APIs
| 🔍 Prometheus
📊 Grafana
| 🚨 Alertmanager
📋 Key Metrics Monitored:
|
Zipkin Integration
- URL: http://localhost:9411/zipkin/
- Features: Request flow visualization, latency analysis, dependency mapping
- Integration: Micrometer Tracing with Spring Boot
--- title: 🚨 Monitoring & Alerting Flow --- flowchart TD subgraph "📊 Microservices" MS1[📚 Catalog Service] MS2[📦 Inventory Service] MS3[🛍️ Order Service] MS4[💳 Payment Service] end PROM[🔍 Prometheus Server] AM[🚨 AlertManager] GRAF[📊 Grafana] RULES[📋 Alert Rules] MS1 --> PROM MS2 --> PROM MS3 --> PROM MS4 --> PROM PROM --> RULES RULES --> AM AM --> |📧 Email| EMAIL[📧 Notifications] AM --> |💬 Slack| SLACK[💬 Chat Alerts] PROM --> GRAF style PROM fill:#ff6b6b style AM fill:#4ecdc4 style GRAF fill:#45b7d1 style RULES fill:#f9ca24 This project demonstrates flexible database schema management using Liquibase with various changelog formats:
| 🏷️ Format | 📁 Service Examples | 📝 Use Case |
|---|---|---|
| XML | order-service, payment-service | Complex migrations, detailed documentation |
| YAML | catalog-service | Human-readable, simple structure |
| JSON | inventory-service | API-friendly, structured data |
| SQL | Custom implementations | Direct SQL control, legacy migrations |
src/main/resources/db/changelog/ ├── db.changelog-master.xml # Master changelog file ├── migrations/ │ ├── 001-initial-schema.xml │ ├── 002-add-indexes.yaml │ └── 003-seed-data.json | 🐘 PostgreSQL Services
Features: ACID compliance, complex queries, relational integrity |
💡 Best Practice: Each service manages its own database schema independently, following the database-per-service pattern
🧹 Cleanup Commands
# 🗑️ Clean up entire Docker system (nuclear option) docker system prune -a -f --volumes # 📦 Remove unused volumes only docker volume prune -f # 🔍 List all running containers docker ps # 📋 List all containers (including stopped) docker ps -a📋 Logging Commands
# 📊 View logs for all services (with monitoring tools) docker-compose -f deployment/docker-compose-tools.yml logs -f # 🎯 View logs for specific service docker-compose -f deployment/docker-compose.yml logs -f order-service # 📜 Follow logs from last 100 lines docker-compose -f deployment/docker-compose-tools.yml logs --tail=100 -f # 🔍 Search logs for specific patterns docker-compose logs | grep ERROR🪟 Windows (PowerShell/CMD)
# 🔍 Find process using port 18080 netstat -ano | findstr :18080 # ⚡ Kill process by PID taskkill /PID <PID_FROM_ABOVE> /F # 🎯 One-liner to kill process on port $process = Get-NetTCPConnection -LocalPort 18080 -ErrorAction SilentlyContinue if ($process) { Stop-Process -Id $process.OwningProcess -Force }🐧 Linux/macOS (Terminal)
# 🔍 Find process using port 18080 sudo lsof -i :18080 # ⚡ Kill process by PID kill -9 <PID_FROM_ABOVE> # 🎯 One-liner to kill process on port sudo kill -9 $(sudo lsof -t -i:18080) # 🔥 Alternative using fuser sudo fuser -k 18080/tcp🔄 Spring Boot 3.x Migration Notes
- 📦 Jakarta EE Namespace: Migration from
javax.*tojakarta.* - 📊 Observability: Spring Cloud Sleuth → Micrometer Tracing
- 🔧 Configuration: Updated property names and patterns
- 🛡️ Security: Enhanced OAuth2/OIDC integration
🧪 Testing Best Practices
// 💰 BigDecimal testing with precision handling import static org.hamcrest.Matchers.closeTo; // ❌ Don't do this: // .andExpected(jsonPath("$.totalPrice").value(100.00)) // ✅ Do this instead: .andExpect(jsonPath("$.totalPrice").value(closeTo(new BigDecimal("100.00"), new BigDecimal("0.01"))))🏗️ Architecture Considerations
- 🔄 Transaction Management: Use
@Transactionaldirectly on jOOQ repository methods - 📊 Event Sourcing: Kafka integration for reliable message delivery
- 🚀 Native Images: Some services may need additional GraalVM configuration
- 🔍 Service Discovery: Health checks are crucial for proper load balancing
# 🚀 Run Gatling performance tests cd gatling-tests # 📊 Basic performance test ./mvnw gatling:test # 🔥 Stress test with custom parameters ./mvnw gatling:test -P stress -DmaxUsers=100 -DrampDurationMinutes=5We welcome contributions from the community! Here's how you can help:
- 🍴 Fork the repository
- 🌟 Create a feature branch:
git checkout -b feature/amazing-feature - 💻 Make your changes with clear, tested code
- 📝 Commit your changes:
git commit -m 'Add amazing feature' - 📤 Push to the branch:
git push origin feature/amazing-feature - 🔄 Open a Pull Request
- 📖 Documentation: Update documentation for any new features
- 🧪 Testing: Add tests for new functionality
- 🎨 Code Style: Follow existing code conventions
- 💬 Discussion: Open an issue first for significant changes
Please read our Code of Conduct to understand our community standards and expectations.
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License - Feel free to use, modify, and distribute! 🎉 - 🌟 Spring Ecosystem: Built on the robust Spring Boot and Spring Cloud frameworks
- 📖 Microservices Patterns: Implementing industry best practices for distributed systems
- 📝 Community Insights: Distributed Transactions in Microservices with Kafka Streams and Spring Boot
- 🏗️ Architecture Patterns: Following domain-driven design principles
- 🔧 DevOps Practices: Docker, monitoring, and observability best practices
- 👥 Community: All contributors and users who make this project better
Made with ❤️ by the Spring Boot Microservices Community


