Order Microservices
- Java
- Spring Boot
- gRPC · Protobuf
- RabbitMQ
- MongoDB
- React
- TypeScript
- Tailwind CSS
- Docker
- Nginx
- GitHub Actions
An order platform with four Java 21 and Spring Boot microservices. Each order leaves a REST API, becomes Protobuf in a gRPC call, is saved to MongoDB, waits in a RabbitMQ queue, and is processed by a worker with retries and a Dead Letter Queue. A React interface shows that path in real time, and anyone can try it online.
- Timeline
- Jun 2025 → Nov 2026
- Architecture
- 4 services · 6 repositories
- Communication
- REST → gRPC → RabbitMQ → SSE
- Hosting
- VPS with Docker Compose and HTTPS

The project
In an online store, accepting an order and processing it are different jobs. Reserving stock and validating payment can be slow or fail, and the customer shouldn't wait for it or lose the order when something goes down. This project separates the two: the server stores the order and answers in milliseconds, and a worker processes the queue at its own pace.
The first version, from 2025, was a study of gRPC between two services. In 2026 it became a complete platform: persistence before queueing, retries, a Dead Letter Queue, events for every step, and an interface that shows it all happening. You can send 50 orders at once, turn the worker off and watch messages pile up without being lost, or force failures and redrive what landed in the DLQ.
Screenshots
See the live pipeline, the guided mode with the real bytes of each format, failure handling, and the detail panels for orders and services.
Live pipeline(2)
Orders moving through the services live Retries and the Dead Letter Queue
Guided mode and orders(2)
Guided mode: JSON × Protobuf with the real bytes Timeline and a real gRPC query
Panels and services(2)
Simulator, metrics, and live events “Why this way?” for every service
The screenshots were taken on the running application, using the simulator's own fictional products and names. In the public demo, every visitor sees everyone's orders in real time. The interface is in Portuguese.
Features
What came from the 2025 version and what was built for the platform in 2026.
- 2025 · 2026
gRPC inside, REST at the edge
The gateway takes JSON, converts it to Protobuf, and calls order-server's PlaceOrder over HTTP/2. The .proto contract lives in its own repository, published as a Maven dependency.
- 2026
Real-time pipeline
Every service publishes events to a RabbitMQ exchange. The gateway forwards them to the browser over Server-Sent Events, and each order shows up as a dot moving between services.
- 2026
Guided mode
Nine steps that pause to explain what happens and why, including the same order in JSON and in Protobuf with the real bytes (about 50% to 60% smaller).
- 2026
Order bursts
Send 20 or 50 orders at once and watch the queue fill up. The worker takes one at a time (prefetch 1) and the queue absorbs the spike.
- 2026
Switchable worker
With the worker off, messages pile up in the broker and none are lost. Turn it back on and the queue drains.
- 2026
Retries and DLQ
A configurable failure rate makes the worker retry with backoff. After 3 failures the order goes to the Dead Letter Queue and can be sent back to the queue with one click (redrive).
- 2025 · 2026
Order timeline
Click an order to see how many milliseconds each step took and query its current state in MongoDB through the GetOrderStatus gRPC call.
- 2026
Live metrics
Completed and dead-lettered orders, queue size, gRPC latency, end-to-end time, and where that time goes: gRPC, waiting in the queue, or processing.
- 2026
Secure by default
Only the frontend publishes a port, databases and broker sit on an internal network with no internet, containers run as non-root and read-only, with per-IP rate limits and validation in both the gateway and the server.
Architecture
Six repositories: a shared contract, three Spring Boot services, the frontend, and a Docker Compose setup that runs everything. Only the edge speaks HTTP to the browser; inside the internal network, services talk over gRPC and AMQP.
- React, TypeScript, Tailwind, and Motion frontend served by nginx with a strict CSP and per-IP rate limits
- order-client receives POST /api/orders as JSON, validates it, and converts it to Protobuf
- Event bridge: subscribes to the order.events exchange with an exclusive queue and forwards to the browser over SSE
- Simulator endpoints (bursts, failure rate, worker switch, redrive) using Java 21 virtual threads
- order-server implements PlaceOrder and GetOrderStatus from the grpc-commons .proto
- Stores the order as PENDING in MongoDB and only then publishes it to pedidos_fila
- order-worker consumes with prefetch 1, retries with backoff, and rejects without requeue after 3 failures
- x-dead-letter-exchange routes rejected messages to pedidos_fila.dlq; redrive uses manual acks
Technical decisions
| Decision | Reason | Consideration |
|---|---|---|
| gRPC inside, REST at the edge | Protobuf is binary and typed by the contract: smaller messages and incompatibilities caught at compile time. | Browsers don't speak native gRPC, so order-client acts as a gateway. |
| .proto contract in its own repository | Client and server generate code from the same file, versioned by tag and published on JitPack. | Changing the contract means publishing a new version and updating consumers. |
| Persist before queueing | No accepted order is lost, and it can be queried even before it is processed. | One database write before responding; the insert rejects a repeated orderId with 409. |
| Queue with retries and a DLQ | The server answers fast, the queue absorbs spikes, and failures don't block the main queue. | Orders in the DLQ need reprocessing, which the redrive handles. |
| SSE instead of WebSocket | The flow is one-way, server to browser, and SSE reconnects on its own over plain HTTP. | The proxy must not buffer the response, and nginx caps it at 4 connections per IP. |
| Internal network, no published ports | Docker bypasses UFW for published ports; with none, MongoDB, RabbitMQ, and gRPC stay unexposed. | Reaching the RabbitMQ dashboard on the VPS requires an SSH tunnel. |
From 2025 to 2026
gRPC study · Jun 2025
- REST gateway that forwarded the order over gRPC to order-server
- Orders went straight to the queue without being saved, so status queries couldn't find them
- order-worker was only the Spring Boot skeleton, with no consumer
- A copy of the .proto inside order-client, besides the one in the server repository
- No visual interface and no failure handling
- RabbitMQ and MongoDB with ports published on the host; only the default contextLoads test
Platform · Nov 2026
- Public demo at orders.matheussaleh.com.br
- Order saved as PENDING before queueing and updated by the worker to COMPLETED or FAILED
- Worker with retries, backoff, a Dead Letter Queue, and redrive
- Single contract in grpc-commons, published as a Maven library
- React visualization with guided mode, metrics, and 12 event types
- Java 21 and Spring Boot 4.2, hardened Docker Compose, tests, and CI with Trivy in every repository
Tests and security
- automated tests
- 17
- CI pipelines
- 5
- CVEs in the last scan
- 0
The tests cover the JSON-to-Protobuf conversion, the mapping between the gRPC message and the MongoDB document, input validation in both the gateway and the server (UUIDs, control characters, size, and out-of-range values), and the worker either completing the order or sending it to the DLQ once its attempts run out. GitHub Actions CI runs the tests, builds the Docker image, and runs Trivy, which fails the build on any fixable high or critical CVE. Dependabot updates dependencies and images every week.
Demo scope
- It is a public demo with no authentication: any visitor can create orders and everyone sees everyone's orders. Don't use real data.
- The worker's processing (stock and payment) is simulated so the queue stays visible. It consumes one order at a time on purpose.
- If someone turns the worker off or sets a 100% failure rate, the settings reset on their own after 3 minutes.
- The interface is in Portuguese.
- Inside the Docker network, gRPC, AMQP, and MongoDB traffic is not encrypted. Next steps are Testcontainers tests and OpenTelemetry tracing.
Watch an order cross the system
Open the demo, send a burst of 50 orders, and turn the worker off. No order is lost.