A modern event-driven order processing service written in Go. It accepts incoming orders through HTTP, stores them in PostgreSQL, emits Kafka events, and asynchronously processes messages in the consumer layer.
This project demonstrates a clean backend flow built for local development and event-driven processing:
- HTTP API for creating and listing orders
- PostgreSQL persistence for durable storage
- Kafka producer for publishing events
- Kafka consumer for async processing
- Typed domain model and clear project layering
Client
|
v
HTTP API
|
| 1) Validate order request
v
OrderController
|
| 2) Save order in PostgreSQL
v
Repository
|
| 3) Publish order event to Kafka
v
Kafka Producer
|
v
Kafka Topic: orders
|
| 4) Consumer reads message
v
Kafka Consumer
|
| 5) Mark order as processed
v
PostgreSQL
- Create orders through a REST endpoint
- List orders from the database
- Persist status transitions
- Publish order events to Kafka
- Process events asynchronously in the consumer
- Maintain a clean separation between API, domain, and infrastructure
- Go 1.26+
- PostgreSQL instance
- Kafka broker
go run .curl http://localhost:8080/healthzResponse:
{"status":"ok"}curl -X POST http://localhost:8080/orders \
-H "Content-Type: application/json" \
-d '{"customer":"Ali","amount":150.5}'curl http://localhost:8080/orders- Local configuration values are kept outside the repository.
- Real credentials should not be committed.
- Kafka and PostgreSQL must be running before launching the app.