A modern microservices platform built with Quarkus for pharmaceutical and functional food retail, featuring Clean Architecture, reactive programming, and comprehensive audit logging.
βββββββββββββββββββββββββββββββββββββββββββ
β Kong API Gateway :8000 β
ββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββ΄βββββββββββ¬ββββββββββββββ¬βββββββββββββββ
β β β β
βββββΌβββββββββββ βββββββΌβββββββββ ββββΌββββββββββββ ββΌβββββββββββ
β Product β β Category β β Audit β β Saga β
β Service β β Service β β Service β βOrchestrateβ
β :8081 β β :8082 β β :8083 β β :8084 β
ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ βββββββββββββ
β β β
ββββββββΌβββββββ ββββββββΌβββββββ ββββββββΌβββββββ
β Product DB β βCategory DB β β Audit DB β
β :5432 β β :5433 β β :5434 β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
βββββββββββββββββββββββββββββββ
β Kafka Message Bus :9092 β
β (Audit Events, Saga) β
βββββββββββββββββββββββββββββββ
- Clean Architecture: Hexagonal architecture with clear separation of concerns
- Reactive Programming: Built on Quarkus Reactive with Mutiny
- Audit Logging: Comprehensive audit trail for pharmaceutical compliance
- Event-Driven: Kafka-based async messaging for audit events
- Saga Orchestration: Distributed transaction management
- API Gateway: Kong for routing, rate limiting, and security
- Multi-Database: Separate PostgreSQL instances per service
- POS Context: Terminal, shift, and pharmacist tracking
- Compliance-Ready: Prescription tracking, batch/lot traceability
- JDK 21+
- Docker & Docker Compose
- Gradle 8.x
- PowerShell (for Windows) or Bash (for Linux/Mac)
# Clone repository
git clone https://github.com/hammond01/cleanslice-platform-quarkus.git
cd HONEY_BEE
# Build all services
./gradlew build
# Or build specific services
./gradlew :services:product-service:build
./gradlew :services:category-service:build
./gradlew :services:audit-service:build# Start all services (databases, Kafka, Kong)
docker-compose up -d
# View logs
docker-compose logs -f
# Check status
docker-compose ps
# Stop all services
docker-compose down# Terminal 1 - Product Service
./gradlew :services:product-service:quarkusDev
# Terminal 2 - Category Service
./gradlew :services:category-service:quarkusDev
# Terminal 3 - Audit Service
./gradlew :services:audit-service:quarkusDev- Products:
http://localhost:8010/products - Categories:
http://localhost:8010/categories - Audit Logs:
http://localhost:8010/audit
- Product Service:
http://localhost:8012/api/products - Category Service:
http://localhost:8013/api/categories - Audit Service:
http://localhost:8011/api/audit
- Product Health:
http://localhost:8012/q/health - Category Health:
http://localhost:8013/q/health - Audit Health:
http://localhost:8011/q/health - Product Metrics:
http://localhost:8012/q/metrics
- Product Swagger:
http://localhost:8012/q/swagger-ui - Category Swagger:
http://localhost:8013/q/swagger-ui - Audit Swagger:
http://localhost:8011/q/swagger-ui - Kong Admin API:
http://localhost:8001 - Kafka UI:
http://localhost:8090
curl -X POST http://localhost:8010/categories `
-H "Content-Type: application/json" `
-d '{
"name": "Pharmaceuticals",
"description": "Prescription and OTC medications",
"slug": "pharmaceuticals"
}'curl -X POST http://localhost:8010/products `
-H "Content-Type: application/json" `
-H "X-Terminal-Id: POS-001" `
-H "X-Store-Id: STORE-HCM-01" `
-d '{
"name": "Paracetamol 500mg",
"description": "Pain reliever and fever reducer",
"price": 25000,
"stock": 1000,
"categoryNumber": "CAT-001",
"requiresPrescription": false,
"batchNumber": "BATCH-2024-001",
"expiryDate": "2025-12-31"
}'curl http://localhost:8010/productscurl http://localhost:8010/products/PROD-001curl -X PUT http://localhost:8010/products/PROD-001 `
-H "Content-Type: application/json" `
-d '{
"name": "Paracetamol 500mg",
"price": 27000,
"stock": 950
}'curl -X DELETE http://localhost:8010/products/PROD-001HONEY_BEE/
βββ services/
β βββ product-service/ # Product management service
β β βββ src/main/java/
β β β βββ application/ # Application layer
β β β β βββ dto/ # Data transfer objects
β β β β βββ mapper/ # Entity-DTO mappers
β β β β βββ port/ # Hexagonal ports
β β β β βββ service/ # Business logic
β β β βββ domain/ # Domain layer
β β β β βββ entity/ # Domain entities
β β β β βββ enums/ # Domain enums
β β β β βββ exception/ # Domain exceptions
β β β βββ infrastructure/ # Infrastructure layer
β β β β βββ messaging/ # Kafka adapters
β β β β βββ persistence/ # Database adapters
β β β β βββ web/ # REST controllers
β β β βββ presentation/ # Presentation layer
β β βββ build.gradle.kts
β β
β βββ category-service/ # Category management service
β β βββ [Same structure as product-service]
β β
β βββ audit-service/ # Audit logging service
β β βββ src/main/java/
β β β βββ application/
β β β β βββ usecase/ # Process audit events
β β β β βββ mapper/
β β β βββ domain/
β β β β βββ entity/ # AuditLog entity
β β β βββ infrastructure/
β β β βββ messaging/ # Kafka consumer
β β β βββ persistence/ # AuditLog repository
β β βββ build.gradle.kts
β β
β βββ saga-orchestration/ # Saga pattern orchestrator
β βββ build.gradle
β
βββ share/ # Shared libraries
β βββ src/main/java/share/
β β βββ context/ # PosContext, UserContext
β β βββ enums/ # Shared enums
β β βββ util/ # Utility classes
β βββ build.gradle.kts
β
βββ core/ # Core utilities
β βββ build.gradle.kts
β
βββ gateway/ # Kong API Gateway config
β βββ kong.yml # Kong declarative config
β βββ docker-compose.yml # Gateway setup
β βββ configure-kong.ps1 # Setup script
β
βββ docs/ # Documentation
β βββ AUDIT_LOGGING_GUIDE.md # Audit system guide
β βββ CLEAN_ARCHITECTURE.md # Architecture docs
β βββ REACTIVE_MIGRATION_REPORT.md
β
βββ docker-compose.yml # Main compose file
βββ build.gradle.kts # Root build config
βββ settings.gradle.kts # Module settings
βββ README.md # This file
| Service | Port | Database |
|---|---|---|
| Audit Service | 8011 | audit_db (PostgreSQL :5432) |
| Product Service | 8012 | product_db (PostgreSQL :5432) |
| Category Service | 8013 | category_db (PostgreSQL :5432) |
| Saga Orchestrator | 8084 | - |
| Kong Gateway | 8010 | kong (PostgreSQL :5432) |
| Kong Admin | 8001 | - |
| Kafka | 9092 | - |
| Kafka UI | 8090 | - |
| Zookeeper | 2181 | - |
| PostgreSQL | 5432 | All databases |
Create .env file for local development:
# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
# Kafka
KAFKA_BOOTSTRAP_SERVERS=localhost:9092
# POS Context
STORE_ID=STORE-HCM-01
STORE_NAME=Main Store- Framework: Quarkus 3.6+ (Reactive)
- Language: Java 21
- Reactive: Mutiny, Vert.x
- Database: PostgreSQL 16 (Reactive Client)
- ORM: Hibernate Reactive Panache
- Messaging: Apache Kafka
- API Gateway: Kong
- Build Tool: Gradle 8.x
- Clean Architecture (Hexagonal)
- CQRS (Command Query Responsibility Segregation)
- Event Sourcing (Audit events)
- Saga Pattern (Distributed transactions)
- Containerization: Docker & Docker Compose
- API Documentation: OpenAPI/Swagger
- Logging: Quarkus Logging + Structured logs
- Health Checks: MicroProfile Health
- Metrics: MicroProfile Metrics
- Complete audit trail for compliance
- Tracks all CRUD operations
- Records prescription validations
- Monitors price changes
- Batch/lot traceability
- See AUDIT_LOGGING_GUIDE.md
@Inject PosContext posContext;
// Set at login/shift start
posContext.setTerminalId("POS-001");
posContext.setStoreId("STORE-HCM-01");
posContext.setShiftId("SHIFT-MORNING");
posContext.setPharmacistId("PHARM-001");- Products and categories use soft delete
- Maintains referential integrity
- Supports audit trail
isDeletedflag withdeletedAttimestamp
- Kafka-based async messaging
- Audit events published to Kafka
- Consumer pattern in audit-service
- Scalable and decoupled
- Non-blocking I/O
- High performance under load
- Backpressure handling
- Resource efficient
# Run all tests
./gradlew test
# Run specific service tests
./gradlew :services:product-service:test
# Run integration tests
./gradlew integrationTest# Check code style
./gradlew checkstyleMain
# Run static analysis
./gradlew check# Using Flyway (if configured)
./gradlew flywayMigrate
# Or manual SQL scripts in src/main/resources/db/migration/- Clean Architecture implementation
- Reactive programming with Mutiny
- Product & Category management
- Comprehensive audit logging
- Kafka event streaming
- Kong API Gateway
- Multi-database setup
- POS context management
- Soft delete pattern
- Saga orchestration implementation
- User authentication & authorization (JWT)
- Role-based access control (RBAC)
- Prescription management module
- Inventory management service
- Sales transaction service
- Customer management service
- Reporting & analytics service
- Redis caching layer
- Elasticsearch for audit search
- Service discovery (Consul)
- Circuit breaker (Resilience4j)
- Rate limiting & throttling
- API versioning
- GraphQL support
- Monitoring (Prometheus + Grafana)
- Distributed tracing (Jaeger)
- CI/CD pipeline (GitHub Actions)
- Kubernetes deployment configs
- Authentication: Implement JWT-based auth
- Authorization: RBAC with pharmacist roles
- Encryption: TLS for all communications
- Secrets: Use secret management (Vault)
- Audit: Enable comprehensive audit logging
- Database: Encrypt data at rest
- API Gateway: Rate limiting, IP whitelisting
- Compliance: HIPAA/GDPR considerations
- Audit Logging Guide - Complete audit system documentation
- Clean Architecture - Architecture principles and patterns
- Reactive Migration Report - Migration to reactive programming
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Clean Architecture principles
- Write reactive code (use Uni/Multi)
- Add comprehensive audit logging
- Include unit and integration tests
- Document public APIs
- Use meaningful variable names
- Keep methods small and focused
This project is licensed under the MIT License - see the LICENSE file for details.
- Architecture: Clean Architecture + Hexagonal
- Development: Quarkus Reactive Stack
- Database: PostgreSQL with Reactive Client
- Messaging: Apache Kafka
- Gateway: Kong API Gateway
Port already in use
# Check which process uses port
netstat -ano | findstr :8081
# Kill the process
taskkill /PID <PID> /FDatabase connection failed
# Check if PostgreSQL is running
docker ps | findstr postgres
# Restart database
docker-compose restart product-dbKafka connection failed
# Check Kafka logs
docker-compose logs kafka
# Restart Kafka
docker-compose restart kafka zookeeperBuild failed
# Clean and rebuild
./gradlew clean build
# Skip tests if needed
./gradlew build -x testFor issues and questions:
- Create an issue in GitHub
- Check documentation in
/docs - Review audit logging guide for compliance questions
Built with β€οΈ for Pharmaceutical Retail Industry
You can run your application in dev mode that enables live coding using:
# Audit Service (Port 8011)
./gradlew :services:audit-service:quarkusDev
# Product Service (Port 8012)
./gradlew :services:product-service:quarkusDev
# Category Service (Port 8013)
./gradlew :services:category-service:quarkusDevNOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at:
- Audit: http://localhost:8011/q/dev/
- Product: http://localhost:8012/q/dev/
- Category: http://localhost:8013/q/dev/
The application can be packaged using:
./gradlew buildIt produces the quarkus-run.jar file in the build/quarkus-app/ directory.
Be aware that it's not an ΓΌber-jar as the dependencies are copied into the build/quarkus-app/lib/ directory.
The application is now runnable using java -jar build/quarkus-app/quarkus-run.jar.
If you want to build an ΓΌber-jar, execute the following command:
./gradlew build -Dquarkus.package.jar.type=uber-jarThe application, packaged as an ΓΌber-jar, is now runnable using java -jar build/*-runner.jar.
You can create a native executable using:
./gradlew build -Dquarkus.native.enabled=trueOr, if you don't have GraalVM installed, you can run the native executable build in a container using:
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=trueYou can then execute your native executable with: ./build/code-with-quarkus-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling.
- REST (guide): A Jakarta REST implementation utilizing build time processing and Vert.x
- REST JSON-B (guide): JSON-B serialization support for Quarkus REST
- Reactive PostgreSQL client (guide): Connect to PostgreSQL using reactive patterns
- Hibernate Reactive Panache (guide): Reactive ORM with Panache
- SmallRye Reactive Messaging (guide): Kafka integration for event streaming
- OpenAPI (guide): API documentation with Swagger UI
- Health Checks (guide): MicroProfile Health for readiness/liveness probes
All REST endpoints are built using reactive patterns with Quarkus REST and return Uni<T> or Multi<T> types for non-blocking operations.
Example:
@GET
@Path("/{number}")
public Uni<GetProduct> getProduct(@PathParam("number") String number) {
return productService.getProductById(number);
}