A production-ready microservices architecture demonstrating inter-service communication with gRPC, built on Quarkus (Supersonic Subatomic Java). This project showcases modern backend engineering patterns for cloud-native applications.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT β
β (HTTP REST / curl) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β HTTP/REST
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β API GATEWAY β
β :8080 (REST) β
β Quarkus REST Client β
ββββββββββββββββ¬βββββββββββββββββββββββ¬ββββββββββββββββββββββββ
β gRPC β gRPC
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β USER SERVICE β β ORDER SERVICE β
β :9000 (gRPC) β β :9001 (gRPC) β
β :8081 (HTTP) β β :8082 (HTTP) β
β β β β
β - CreateUser β β - CreateOrder β
β - GetUser β β - GetOrder β
β - ListUsers β β - ListOrdersByUser β
β - UpdateUser β β - UpdateOrderStatus β
β - DeleteUser β β - DeleteOrder β
β β β β
β [In-Memory Store] β β [In-Memory Store] β
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
| Layer | Technology | Purpose |
|---|---|---|
| Framework | Quarkus 3.x | Supersonic Java runtime |
| Communication | gRPC + Protocol Buffers | Efficient inter-service RPC |
| API | REST (JAX-RS) | Public-facing HTTP endpoints |
| Serialization | Protobuf 3 | Type-safe binary serialization |
| Build | Maven 3.9 | Dependency management |
| Container | Docker + Docker Compose | Local orchestration |
| Java | Java 17 | LTS runtime |
grpc-microservices-quarkus/
βββ proto/ # Shared Protobuf definitions
β βββ user.proto # User service contract
β βββ order.proto # Order service contract
β
βββ user-service/ # User microservice
β βββ src/main/
β β βββ java/com/portfolio/user/
β β β βββ grpc/ # gRPC service implementation
β β β βββ resource/ # REST endpoints (health, metrics)
β β β βββ service/ # Business logic
β β βββ proto/ # Local proto files
β β βββ resources/
β β βββ application.properties
β βββ pom.xml
β
βββ order-service/ # Order microservice
β βββ src/main/
β β βββ java/com/portfolio/order/
β β β βββ grpc/ # gRPC service implementation
β β β βββ resource/ # REST endpoints
β β β βββ service/ # Business logic
β β βββ proto/
β β βββ resources/
β β βββ application.properties
β βββ pom.xml
β
βββ api-gateway/ # REST Gateway
β βββ src/main/
β β βββ java/com/portfolio/gateway/
β β β βββ client/ # gRPC stub clients
β β β βββ dto/ # Data transfer objects
β β β βββ resource/ # REST controllers
β β βββ proto/
β β βββ resources/
β β βββ application.properties
β βββ pom.xml
β
βββ docker-compose.yml # Full stack orchestration
βββ docs/
β βββ api-guide.md # API documentation
βββ README.md
- Java 17+
- Maven 3.9+
- Docker & Docker Compose
# Clone the repository
git clone https://github.com/YOUR_USERNAME/grpc-microservices-quarkus.git
cd grpc-microservices-quarkus
# Build and start all services
docker-compose up --build
# Verify services are running
curl http://localhost:8080/healthTerminal 1 β User Service
cd user-service
./mvnw quarkus:dev -Dquarkus.http.port=8081Terminal 2 β Order Service
cd order-service
./mvnw quarkus:dev -Dquarkus.http.port=8082Terminal 3 β API Gateway
cd api-gateway
./mvnw quarkus:dev -Dquarkus.http.port=8080| Method | Endpoint | Description |
|---|---|---|
POST |
/api/users |
Create a new user |
GET |
/api/users |
List all users |
GET |
/api/users/{id} |
Get user by ID |
PUT |
/api/users/{id} |
Update user |
DELETE |
/api/users/{id} |
Delete user |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/orders |
Create a new order |
GET |
/api/orders |
List all orders |
GET |
/api/orders/{id} |
Get order by ID |
GET |
/api/orders/user/{userId} |
Get orders by user |
PUT |
/api/orders/{id}/status |
Update order status |
DELETE |
/api/orders/{id} |
Delete order |
# 1. Create a user
curl -X POST http://localhost:8080/api/users -H "Content-Type: application/json" -d "{\"name\":\"Budi Santoso\",\"email\":\"budi@example.com\"}"
# 2. List all users
curl http://localhost:8080/api/users
# 3. Create an order for user ID 1
curl -X POST http://localhost:8080/api/orders -H "Content-Type: application/json" -d "{\"userId\":\"1\",\"productName\":\"Laptop ASUS\",\"quantity\":1,\"price\":12000000}"
# 4. Get orders by user
curl http://localhost:8080/api/orders/user/1
# 5. Update order status
curl -X PUT http://localhost:8080/api/orders/1/status -H "Content-Type: application/json" -d "{\"status\":\"SHIPPED\"}"
- Defining service contracts with
.protofiles - Strongly-typed request/response messages
- Code generation for Java stubs
- Implementing generated
ImplBaseclasses - Unary RPC calls
- StreamObserver pattern for async responses
- Using
@GrpcClientinjection - Blocking stub calls from REST handlers
- Error propagation across service boundaries
- Single entry point for all client requests
- Protocol translation: REST β gRPC
- Response aggregation
- Health check endpoints (
/q/health) - Metrics endpoint (
/q/metrics) - Docker-optimized builds
| Feature | gRPC | REST |
|---|---|---|
| Protocol | HTTP/2 | HTTP/1.1 |
| Payload | Binary (Protobuf) | Text (JSON) |
| Contract | Strict (.proto) | Optional (OpenAPI) |
| Performance | ~7x faster | Baseline |
| Streaming | Native support | Polling/SSE |
| Code Gen | Auto-generated | Manual |
β If this helped you understand gRPC with Quarkus, please give it a star!