A production-style microservices backend that simulates e-commerce fulfillment. Orders come in, stock gets reserved, shipments are created with tracking numbers, and customers get notified — services never call each other, they just react to events.
The API Gateway authenticates and fans out REST calls to four independent services. They never call each other directly — they coordinate by publishing and consuming events on a RabbitMQ topic exchange.
Every service owns its data, trusts the gateway, and recovers from failure on its own. The patterns below are the difference between a demo and something you'd actually run.
Services coordinate through events, never direct calls. OrderCreated ripples through
inventory, shipping, and notifications with no central orchestrator.
The gateway issues JWTs (bcrypt-hashed creds) and enforces roles. Internal services trust
X-User-Id / X-User-Role headers — inventory management is ADMIN-only.
Stock reservation and shipment creation are keyed on order_id, so a redelivered
event never double-reserves stock or creates a duplicate shipment.
Durable queues retry with exponential backoff, then dead-letter to a DLQ after
MAX_RETRIES — poison messages are isolated, never silently dropped.
Hot reads are cached in Redis and invalidated on write. If the cache is down, requests degrade to a clean miss against Postgres rather than failing.
Each service owns a private PostgreSQL database (async SQLAlchemy 2.0 + asyncpg, migrated by Alembic). No shared tables, no hidden coupling.
Every event carries an envelope with a request-id, so a single order can be traced
end-to-end across all four services and the message bus.
Pytest suites cover services and event handlers, run in CI via GitHub Actions on every push — so refactors stay honest.
Place an order and watch it propagate. The happy path completes a fulfillment; if stock runs out, the order branches cleanly into a cancellation.
A pragmatic, production-leaning stack — fully containerized so the entire mesh comes up with one command.
Clone the repo, copy the example environment, and bring the whole mesh up with Docker Compose.
# 1 — clone the repo $ git clone https://github.com/jyotir07/ordermesh && cd ordermesh # 2 — set up environment $ cp .env.example .env # 3 — bring the whole mesh up $ docker-compose up --build