Enterprise-grade Event-Driven Microservices Platform with AI Integration
Clean Architecture β’ SOLID Principles β’ Domain-Driven Design β’ Event-Driven Architecture
Features β’ Architecture β’ Quick Start β’ Documentation β’ Deployment
- Overview
- Features
- System Architecture
- Microservices Architecture
- Tech Stack
- Quick Start
- API Documentation
- Testing
- Deployment
- Project Structure
- Contributing
- License
Product Comparison Platform is a production-ready, event-driven microservices platform designed for e-commerce product analysis and comparison. Built with Clean Architecture principles, the system leverages AI-powered insights using AWS Bedrock (Claude 4.5) to deliver intelligent product recommendations.
β
Event-Driven Architecture β RabbitMQ message broker with async processing
β
Clean Architecture β Domain-centric design, framework-independent
β
Microservices Pattern β 2 independent services with clear boundaries
β
AI Integration β AWS Bedrock Claude 4.5 for product analysis
β
DevSecOps Ready β GitHub Actions, Trivy, SonarQube, ArgoCD
β
Cloud Native β Kubernetes/EKS deployment with Terraform IaC
β
Production Ready β Multi-AZ, auto-scaling, monitoring, backup
| Feature | Description |
|---|---|
| ποΈ Product Management | Full CRUD operations with REST API |
| π€ AI-Powered Analysis | Automatic product insights via AWS Bedrock |
| π Advanced Search | Filter by category, price range, ratings |
| π Product Comparison | Side-by-side comparison with AI recommendations |
| π¨ Event-Driven | Async processing with RabbitMQ messaging |
| π Real-time Updates | Product changes trigger automatic AI analysis |
ποΈ Clean Architecture π¦ Value Objects (Money, Rating)
π― SOLID Principles π Repository Pattern
π‘ Event-Driven Messaging π³ Docker Compose support
βΈοΈ Kubernetes Ready π§ͺ Comprehensive test coverage
π Input Validation π OpenAPI/Swagger docs
Production Environment - Scalable, highly available deployment on AWS
Infrastructure:
- Amazon EKS - Kubernetes cluster (v1.28) across 2 AZs
- Amazon MQ - Managed RabbitMQ (Multi-AZ)
- Amazon RDS - PostgreSQL 15 (Multi-AZ, Read Replicas)
- Amazon ECR - Container image registry
- AWS Bedrock - Claude 4.5 Sonnet for AI analysis
- Application Load Balancer - Traffic distribution
- CloudWatch - Logs, metrics, and monitoring
High Availability:
β
Multi-AZ deployment (1a, 1b)
β
Auto-scaling: Product Service (3 replicas), AI Service (2 replicas)
β
RDS automated backups + read replicas
β
Health checks + graceful shutdown
CI/CD & Infrastructure as Code
Tools:
| Stage | Tool | Purpose |
|---|---|---|
| π§ Source Control | GitHub | Version control, triggers |
| β‘ CI/CD | GitHub Actions | Build, test, deploy automation |
| π‘οΈ Security Scan | Trivy | Container vulnerability scanning |
| π Code Quality | SonarQube | Static analysis, code coverage |
| ποΈ Infrastructure | Terraform | IaC for AWS resources |
| π GitOps Deploy | ArgoCD | Kubernetes deployment sync |
| π¦ Registry | Amazon ECR | Docker image storage |
Pipelines:
-
Infrastructure Pipeline (Terraform)
- Init β Validate β Plan β Apply β Provision AWS resources
-
Application Pipeline (Microservices)
- Build β Security Scan β Docker Build β Push ECR β Deploy via ArgoCD
Development Environment - Run locally with Docker Compose
Components:
- Product Service (Port 8080) - REST API, Event Publisher
- AI Service (Port 8081) - Event Consumer, AI Analysis
- RabbitMQ (Ports 5672, 15672) - Message Broker
- PostgreSQL - Databases:
productdb,aidb
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Access services
http://localhost:8080 # Product Service API
http://localhost:8081 # AI Service API
http://localhost:15672 # RabbitMQ Management (guest/guest)Request Flow - HTTP REST API with Clean Architecture
Flow:
1οΈβ£ Client sends HTTP POST request
2οΈβ£ ProductController receives and validates input
3οΈβ£ ProductMapper converts DTO β Domain
4οΈβ£ CreateProductUseCase executes business logic
5οΈβ£ Product Entity validates itself (Value Objects)
6οΈβ£ ProductRepository saves to database
7οΈβ£ ProductRepositoryAdapter converts Domain β JPA Entity
8οΈβ£ JPA persists to PostgreSQL (productdb)
9οΈβ£ **Publishes event** to RabbitMQ (product.created)
Endpoints:
POST /api/products- Create productGET /api/products- List productsGET /api/products/{id}- Get product by IDPUT /api/products/{id}- Update productDELETE /api/products/{id}- Delete productGET /api/products/category/{category}- Filter by categoryGET /api/products/search?keyword=x- Search products
Event-Driven Flow - Async AI analysis via RabbitMQ
Flow:
1οΈβ£ Product-Service publishes event to RabbitMQ
2οΈβ£ RabbitMQ routes to product.ai.analysis.queue
3οΈβ£ ProductEventListener consumes message
4οΈβ£ Routes to AnalyzeProductUseCase
5οΈβ£ UseCase calls AIService (port)
6οΈβ£ LambdaAIAdapter calls AWS Bedrock Claude 4.5
7οΈβ£ AI generates analysis & insights (strengths, weaknesses, score)
8οΈβ£ Creates ProductAnalysis entity
9οΈβ£ AnalysisRepository saves to PostgreSQL (aidb)
π Analysis available via REST API
AI Providers:
- Production: AWS Bedrock Claude 4.5 (
@Profile("cloud")) - Development: Mock AI Adapter (
@Profile("mock"))
Analysis Output:
{
"productId": 1,
"analysisText": "High-quality flagship smartphone...",
"aiScore": 92,
"insights": ["Premium build quality", "Excellent camera"],
"strengths": ["Performance", "Design"],
"weaknesses": ["Price premium"],
"recommendations": ["Best for power users"]
}| Technology | Version | Purpose |
|---|---|---|
| β Java | 21 LTS | Programming language |
| π Spring Boot | 3.2.0 | Application framework |
| ποΈ Spring Data JPA | 3.2.0 | Data access layer |
| π° RabbitMQ | 3.12 | Message broker |
| π PostgreSQL | 15 | Relational database |
| π§ AWS Bedrock | Claude 4.5 | AI analysis (production) |
| π¨ Maven | 3.9+ | Build tool |
| Technology | Version | Purpose |
|---|---|---|
| π³ Docker | 24.0+ | Containerization |
| βΈοΈ Kubernetes | 1.28 | Container orchestration |
| ποΈ Terraform | 1.6+ | Infrastructure as Code |
| β‘ GitHub Actions | - | CI/CD pipeline |
| π ArgoCD | 2.9+ | GitOps deployment |
| π‘οΈ Trivy | Latest | Security scanning |
| π SonarQube | 10.3+ | Code quality |
| βοΈ AWS | - | Cloud provider (EKS, RDS, MQ, Bedrock) |
π§ͺ JUnit 5 π Springdoc OpenAPI
π Mockito π Swagger UI
β
REST Assured π Jacoco (Coverage)
# Required
Java 21+
Maven 3.9+
Docker & Docker Compose
# Check versions
java --version
mvn --version
docker --version
docker-compose --version# 1. Clone repository
git clone https://github.com/vynnydev/product-comparison-platform.git
cd product-comparison-platform
# 2. Start all services
docker-compose up -d
# 3. Verify services are running
docker-compose ps
# 4. View logs
docker-compose logs -f product-service
docker-compose logs -f ai-service
# 5. Test the API
curl http://localhost:8080/api/products| Service | URL | Credentials |
|---|---|---|
| π¦ Product Service | http://localhost:8080 | - |
| π€ AI Service | http://localhost:8081 | - |
| π Swagger (Product) | http://localhost:8080/swagger-ui.html | - |
| π Swagger (AI) | http://localhost:8081/swagger-ui.html | - |
| π° RabbitMQ Management | http://localhost:15672 | guest / guest |
Base URL: http://localhost:8080/api
curl -X POST http://localhost:8080/api/products \
-H "Content-Type: application/json" \
-d '{
"name": "MacBook Pro 16 M3 Max",
"description": "Powerful laptop for developers",
"imageUrl": "https://example.com/macbook.jpg",
"price": 3499.99,
"rating": 4.9,
"category": "Laptops",
"inStock": true,
"specifications": {
"processor": "M3 Max",
"ram": "64GB",
"storage": "2TB SSD"
}
}'Response: 201 Created
{
"id": 1,
"name": "MacBook Pro 16 M3 Max",
"price": 3499.99,
"rating": 4.9,
"createdAt": "2024-11-27T19:00:00"
}π― This triggers an event β AI Service automatically analyzes the product
curl http://localhost:8081/api/ai/product/1Response: 200 OK
{
"productId": 1,
"aiScore": 95,
"analysisText": "Premium professional laptop with exceptional performance...",
"insights": [
"Top-tier M3 Max processor delivers outstanding performance",
"64GB RAM ideal for heavy multitasking",
"Excellent build quality and design"
],
"strengths": ["Performance", "Display", "Build Quality"],
"weaknesses": ["High price point", "Limited upgradeability"],
"recommendations": ["Best for professional developers and content creators"]
}Access Swagger UI for complete API documentation:
- Product Service: http://localhost:8080/swagger-ui.html
- AI Service: http://localhost:8081/swagger-ui.html
# Product Service tests
cd backend/services/product-service
mvn clean test
# AI Service tests
cd backend/services/ai-service
mvn clean test
# Integration tests
cd backend/scripts/integrated-tests/product-service
./integrated-tests.sh# Generate coverage report
mvn clean test jacoco:report
# View report
open target/site/jacoco/index.htmlCurrent Coverage: 85%
# Test complete event-driven flow
cd backend/scripts/messaging
./demo-events.sh
# Monitor RabbitMQ
./monitor-rabbitmq.shRequirements: Docker & Docker Compose
# Start services
docker-compose up -d
# Scale services
docker-compose up -d --scale product-service=3
# Stop services
docker-compose down
# Clean everything
docker-compose down -vQuick Overview:
# 1. Provision infrastructure with Terraform
cd infrastructure/terraform
terraform init
terraform plan
terraform apply
# 2. Deploy applications with ArgoCD
kubectl apply -f infrastructure/k8s/argocd/
# 3. Sync applications
argocd app sync product-service
argocd app sync ai-serviceInfrastructure Components:
β
VPC (10.0.0.0/16)
β
EKS Cluster (2 AZs)
β
Amazon MQ (RabbitMQ Multi-AZ)
β
RDS PostgreSQL (Multi-AZ + Read Replicas)
β
Application Load Balancer
β
ECR Repositories
β
CloudWatch Logging
product-comparison-platform/
βββ backend/
β βββ services/
β β βββ product-service/ # π¦ Product Management
β β β βββ src/
β β β β βββ main/java/.../
β β β β β βββ adapter/ # Controllers, DTOs
β β β β β βββ domain/ # Entities, Value Objects
β β β β β βββ usecase/ # Business Logic
β β β β β βββ config/ # Spring Config
β β β β βββ resources/
β β β βββ Dockerfile
β β β βββ pom.xml
β β β
β β βββ ai-service/ # π€ AI Analysis
β β βββ src/
β β β βββ main/java/.../
β β β β βββ adapter/
β β β β β βββ input/messaging/ # Event Listeners
β β β β β βββ output/ai/ # Bedrock/Mock Adapters
β β β β βββ domain/
β β β β βββ usecase/
β β β β βββ config/
β β β βββ resources/
β β βββ Dockerfile
β β βββ pom.xml
β β
β βββ scripts/
β β βββ messaging/
β β β βββ demo-events.sh # Test event flow
β β β βββ monitor-rabbitmq.sh # Monitor messages
β β βββ integrated-tests/ # Integration tests
β β
β βββ docker-compose.yaml # Local environment
β
βββ infrastructure/
β βββ terraform/
β β βββ modules/
β β β βββ vpc/
β β β βββ eks/
β β β βββ rds/
β β β βββ mq/
β β βββ main.tf
β β βββ variables.tf
β βββ scripts/
β
βββ docs/
β βββ architecture/
β β βββ images/ # Architecture diagrams
β βββ images/ # Screenshots
β
βββ .github/
β βββ workflows/
β βββ ci-product-service.yml
β βββ ci-ai-service.yml
β βββ terraform.yml
β
βββ README.md
Each service follows the same structure:
adapter/
βββ input/ # REST Controllers, Event Listeners
βββ output/ # Repositories, External APIs
βββ mapper/ # DTOs β Domain conversion
domain/
βββ model/ # Entities (Aggregate Roots)
βββ valueobject/ # Money, Rating, etc.
βββ repository/ # Ports (Interfaces)
βββ exception/ # Domain exceptions
usecase/ # Application business logic
βββ CreateProductUseCase.java
βββ AnalyzeProductUseCase.java
βββ ...
config/ # Spring configuration
β
Domain Independence β Core logic has zero framework dependencies
β
Dependency Inversion β All dependencies point inward
β
Testability β Easy to test without mocking frameworks
β
Flexibility β Swap frameworks without changing business logic
| Principle | Implementation |
|---|---|
| Single Responsibility | Each class has one reason to change |
| Open/Closed | Open for extension, closed for modification |
| Liskov Substitution | Implementations interchangeable via interfaces |
| Interface Segregation | Focused, specific interfaces |
| Dependency Inversion | Depend on abstractions, not concretions |
π¨ Async Communication β Services communicate via events
π Eventual Consistency β Data synchronized asynchronously
π Event Sourcing Ready β Events as source of truth
π― Decoupled Services β Services don't know about each other
Contributions are welcome! Please follow these guidelines:
# 1. Fork the repository
# 2. Create feature branch
git checkout -b feature/amazing-feature
# 3. Make changes and test
mvn clean test
# 4. Commit with conventional commits
git commit -m "feat: add amazing feature"
# 5. Push and create PR
git push origin feature/amazing-featureFollow Conventional Commits:
feat: New feature
fix: Bug fix
docs: Documentation changes
refactor: Code refactoring (no behavior change)
test: Adding or updating tests
chore: Maintenance tasks
ci: CI/CD changes
# Run all checks before committing
mvn clean verify # Build + tests
mvn spotless:check # Code formatting
mvn checkstyle:check # Style violationsThis project is licensed under the MIT License - see the LICENSE file for details.
Vinicius Prudencio (Vini)
Backend Developer & DevOps Engineer
- π Specialized in Clean Architecture & Cloud-Native Solutions
- βοΈ AWS | Terraform | Kubernetes | ArgoCD | GitHub Actions
- πΌ LinkedIn
- π GitHub
- Uncle Bob - Clean Architecture principles
- Eric Evans - Domain-Driven Design concepts
- Spring Team - Excellent framework and documentation
- AWS - Cloud infrastructure and AI services
- Open Source Community - Amazing tools and libraries







