A cloud-native microservices application built using Spring Boot, Apache Kafka, MySQL, Docker, and Kubernetes. This project demonstrates the fundamentals of distributed systems using event-driven architecture, REST APIs, and modern container orchestration.
The Hello Application is a microservices-based system that includes:
- Producer Service – Publishes messages to Kafka.
- Consumer Service – Consumes messages from Kafka and writes to MySQL.
- Hello Service – Serves simple REST-based greetings.
- API Gateway – Exposes a unified entry point for routing client requests to internal services.
All services are containerized and managed with Docker Compose and Kubernetes for scalable deployment.
hello-app/
│
├── producer-service/
│ ├── src/...
│ ├── Dockerfile
│
├── consumer-service/
│ ├── src/...
│ ├── Dockerfile
│
├── hello-service/
│ ├── src/...
│ ├── Dockerfile
│
├── api-gateway/
│ ├── src/...
│ ├── Dockerfile
│
├── docker/
│ ├── docker-compose.yml (Kafka + MySQL)
│
└── k8s/
├── producer-deployment.yml
├── consumer-deployment.yml
├── mysql-deployment.yml
├── kafka-deployment.yml
├── gateway-ingress.yml
- Microservices: Spring Boot services (producer, consumer, hello-service)
- Event Broker: Kafka (Confluent Platform)
- Database: MySQL
- Gateway: Spring Cloud Gateway
+------------------------+
| API Gateway |
| (Spring Cloud) |
+-----------+------------+
|
+-----------------------------+-----------------------------+
| | |
v v v
+-------------+ +---------------+ +-------------+
| Hello | | Producer | | Kafka |
| Service | | Service |-------------->| (Broker) |
+-------------+ +---------------+ +-------------+
| |
| v
| +---------------+
| | Consumer |
+-----------------------------------------------> | Service |
| (writes to DB)|
+-------+-------+
|
v
+---------------+
| MySQL |
| hello_db |
+---------------+
-
Open your terminal and navigate to the Docker setup folder:
cd docker -
Build and start all containers:
docker compose up --build -d
- API Gateway:
http://localhost:8080 - Producer Service:
http://localhost:8081 - Consumer Service:
http://localhost:8082 - Hello Service:
http://localhost:8083 - Kafka Broker:
localhost:9092 - MySQL Database:
localhost:3307(mapped to container's port3306)
All Kubernetes manifests are in the k8s/ directory.
k8s/
├── producer-deployment.yml
├── consumer-deployment.yml
├── hello-deployment.yml
├── kafka-deployment.yml
├── mysql-deployment.yml
└── gateway-ingress.yml
-
Ensure your Kubernetes cluster is running
You can use tools like Docker Desktop (with Kubernetes enabled) or Minikube. -
Apply all the Kubernetes manifests
Run the following command from the project root:kubectl apply -f k8s/
-
Verify the resources are up and running
kubectl get pods kubectl get svc
-
If using an Ingress Controller (like NGINX), make sure it's installed and running The gateway will be exposed via the gateway-ingress.yml.
- Java 21, Spring Boot
- Apache Kafka
- MySQL
- Docker & Docker Compose
- Kubernetes
- Spring Cloud Gateway
- Pranav Singh Solanki