https://github.com/Pranavsolanki01/Realtime-Communication
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.
https://github.com/Pranavsolanki01/Realtime-Communication
apache-kafka cloudnative cloudnative-services docker docker-compose docker-container java kubernetes kubernetes-cluster kubernetes-deployment microservice microservices-architecture spring-boot springboot
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/Pranavsolanki01/Realtime-Communication
- Owner: Pranavsolanki01
- Created: 2025-07-05T15:08:03.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-07-05T15:52:45.000Z (9 months ago)
- Last Synced: 2025-07-05T16:36:41.374Z (9 months ago)
- Topics: apache-kafka, cloudnative, cloudnative-services, docker, docker-compose, docker-container, java, kubernetes, kubernetes-cluster, kubernetes-deployment, microservice, microservices-architecture, spring-boot, springboot
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Realtime-Communication
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.
---
## π Project Overview
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.
---
## π Folder Structure
```
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
```
## π§± Architecture
### Components:
- **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 |
+---------------+
```
---
## π³ Docker Setup
### π Prerequisites
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)
### βοΈ Steps to Run
1. Open your terminal and navigate to the Docker setup folder:
```bash
cd docker
```
2. Build and start all containers:
```bash
docker compose up --build -d
```
#### Steps to Run Locally (Outside of the Docker)
### π Services will be available on:
- **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 port `3306`)
## βΈοΈ Kubernetes Setup
All Kubernetes manifests are in the `k8s/` directory.
### π Kubernetes Files
```
k8s/
βββ producer-deployment.yml
βββ consumer-deployment.yml
βββ hello-deployment.yml
βββ kafka-deployment.yml
βββ mysql-deployment.yml
βββ gateway-ingress.yml
```
### βοΈ Steps to Deploy
1. **Ensure your Kubernetes cluster is running**
You can use tools like Docker Desktop (with Kubernetes enabled) or Minikube.
2. **Apply all the Kubernetes manifests**
Run the following command from the project root:
```bash
kubectl apply -f k8s/
```
3. **Verify the resources are up and running**
```bash
kubectl get pods
kubectl get svc
```
4. **If using an Ingress Controller (like NGINX), make sure it's installed and running**
The gateway will be exposed via the gateway-ingress.yml.
## π¦ Technologies Used
- **Java 21, Spring Boot**
- **Apache Kafka**
- **MySQL**
- **Docker & Docker Compose**
- **Kubernetes**
- **Spring Cloud Gateway**
## π¨βπ» Author
- **Pranav Singh Solanki**
##### Feel free to open issues or contribute to the project!