Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order Processor Service

Go 1.26+ Kafka PostgreSQL REST API

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.

Overview

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

Architecture

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

Features

  • 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

Prerequisites

  • Go 1.26+
  • PostgreSQL instance
  • Kafka broker

Run

go run .

Endpoints

GET /healthz

curl http://localhost:8080/healthz

Response:

{"status":"ok"}

POST /orders

curl -X POST http://localhost:8080/orders \
  -H "Content-Type: application/json" \
  -d '{"customer":"Ali","amount":150.5}'

GET /orders

curl http://localhost:8080/orders

Notes

  • Local configuration values are kept outside the repository.
  • Real credentials should not be committed.
  • Kafka and PostgreSQL must be running before launching the app.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages