This project uses Quarkus — the Supersonic Subatomic Java Framework.
The goal of this template is to provide engineers with a quick and practical reference for the most common enterprise use cases when building microservices with Quarkus.
- REST API exposure
- Database integration with connection pooling
- Bean declarations via configuration classes
- Micrometer metrics endpoint exposure
- Health checks for readiness and liveness
- REST Clients using connection pools
- Swagger/OpenAPI generation and exposure
- Hexagonal architecture
- YAML configuration
- Config-to-class binding
- MapStruct integration
- Structured logging with JSON for PROD
- MDC correlation ID generation and propagation to REST clients
- Centralized error handling
- Dependency version monitoring
- CI/CD with GitHub Actions
- Pull request builds
- Main branch builds
- Release builds
- Native binary generation and attachment to GitHub releases
- Docker image publishing to Docker Hub
- OpenID Connect support via Keycloak
- Integration tests (JVM and Native mode)
- Mocking
- Architecture unit tests
- WireMock for stubbing
- Gatling-based stress testing (targeting different environments)
- ❌ Custom metrics per endpoint
- ❌ Resilience4J for REST clients
- ❌ Pagination support
- ❌ Audit logging for tables
- ❌ Event sourcing and outbox pattern
- ❌ BDD-style tests
./gradlew quarkusDev
Access Dev UI: http://localhost:8080/q/dev
./gradlew build
Run the app:
java -jar build/quarkus-app/quarkus-run.jar
./gradlew build -Dquarkus.package.jar.type=uber-jar
./gradlew clean build -Dquarkus.package.jar.enabled=false -Dquarkus.native.enabled=true
./gradlew build -Dquarkus.native.container-build=true
After building the native executable:
docker build -f src/main/docker/Dockerfile.native-micro -t com.caelcs/quarkus-template .
./gradlew clean testNative
- Rancher Desktop or Minikube
cd src/gatling/kubernetes
kubectl apply -f postgres.yaml -f keycloak.yaml -f quarkus-template.yaml
kubectl port-forward svc/quarkus-app 8081:8080
kubectl port-forward svc/keycloak 8082:8080
kubectl port-forward svc/postgres 5432:5432
Access Keycloak: http://localhost:8082
clientId: quarkus-template-app
clientSecret: YSFwvyazqPmLukTvwBWa0ZhlhtP3T031
Username | Password | Roles |
---|---|---|
alice | alice | user |
john | john | admin |
linda | linda | support |
lucas | lucas | report |
pinza | pinza | user, admin, support, report |
export access_token=$(curl -X POST http://localhost:8082/realms/quarkus-template/protocol/openid-connect/token \
--user quarkus-template-app:YSFwvyazqPmLukTvwBWa0ZhlhtP3T031 \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=alice&password=alice&grant_type=password' | jq -r '.access_token')
kubectl delete -f postgres.yaml -f keycloak.yaml -f quarkus-template.yaml
kubectl apply -f postgres.yaml -f keycloak.yaml
kubectl get pods
kubectl exec -it <keycloak-pod-id> -- /opt/keycloak/bin/kc.sh export --dir /opt/keycloak/data/export --users realm_file
kubectl exec -it <keycloak-pod-id> -- cat /opt/keycloak/data/export/quarkus-template-realm.json
Paste the realm JSON into resources/test-realm.json
.
- Pull Request: Triggered on
feature/*
targetingmain
- Main Branch: On push to
main
- Release: On GitHub Release tagged as
v*
git tag -a v1.0.15 -m "Release version 1.0.15"
git push origin v1.0.15
- Rancher Desktop or Minikube
- Prometheus Operator installed. This would give you Prometheus and Grafana
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus-operator prometheus-community/kube-prometheus-stack \
--set alertmanager.enabled=false \
--set prometheus.prometheusSpec.podMonitorSelector.matchLabels.team=backend
- CRD for Vertical scaling for Postgres
helm repo add fairwinds-stable https://charts.fairwinds.com/stable
helm repo update
helm install vpa fairwinds-stable/vpa
docker build -f src/gatling/docker/Dockerfile -t adolfoecs/quarkus-template-gatling:1.0.0 .
Update the image in src/gatling/kubernetes/gatling.yaml
and apply:
kubectl apply -f src/gatling/kubernetes/postgres.yaml \
-f src/gatling/kubernetes/keycloak.yaml \
-f src/gatling/kubernetes/quarkus-template.yaml \
-f src/gatling/kubernetes/gatling.yaml