Skip to content

Dockerized .NET 8 microservices e-commerce backend with API Gateway, RabbitMQ messaging, JWT auth, and multi-database architecture.

Notifications You must be signed in to change notification settings

Srihareddy/CloudBazzar

Repository files navigation

CloudBazzar

CloudBazzar is a Dockerized microservices-based e-commerce backend built with .NET 8, RabbitMQ, SQL Server, and API Gateway, demonstrating event-driven architecture, JWT authentication, and service-to-service communication.

Architecture Overview

Services included:

API Gateway – Single entry point for all services

Identity API – JWT token generation & authentication

Ordering API – Create and manage orders

Payment API – Event-driven payment processing

Catalog API – Product catalog

Basket API – Shopping cart

Notification Worker – Background consumer

RabbitMQ – Event bus

SQL Server – Orders database

PostgreSQL – Catalog database

Redis – Basket cache

Seq – Centralized logging

OpenTelemetry Collector – Observability

🔐 Authentication (Identity Service)

Generates JWT tokens used to authorize requests across microservices.

Identity Token


📦 Create Order (Ordering Service)

Creates a new order and publishes an OrderCreated event.

Create Order


🔎 Get Order by ID

Fetches order details from SQL Server.

Get Order


💳 Payment Processing (Event Consumer)

Payment service consumes OrderCreated events from RabbitMQ.

Payment Consumer Log


🐇 RabbitMQ – Payment Queue

Shows message flow and active consumer.

RabbitMQ Overview


🌐 API Gateway Routes

Centralized routing through Gateway API.

Gateway Routes


🔑 Swagger Authorization

JWT-based authorization in Swagger UI.

Swagger Authorize

Event-Driven Flow

Order Created ↓ RabbitMQ (shopsphere.events) ↓ Payment Consumer ↓ PaymentSucceeded / PaymentFailed

What’s inside

  • Microservices: Catalog, Basket, Ordering, Payment, Notification
  • API Gateway: YARP reverse proxy
  • Datastores: PostgreSQL (Catalog), SQL Server (Ordering), Redis (Basket)
  • Messaging: RabbitMQ event bus (publish/subscribe)
  • Observability: OpenTelemetry (traces), Serilog → Seq, health checks
  • Testing: xUnit (starter tests) + basic integration test pattern
  • CI: GitHub Actions build + test
  • Containers: Dockerfiles + docker-compose (one command runs everything)

Quick start (Docker)

Prereqs: Docker Desktop

cd deploy/docker-compose
docker compose up --build

Then open:

Auth (Dev)

A simple dev JWT issuer is included:

  • Identity API: POST http://localhost:5006/token
  • Use the returned JWT as Authorization: Bearer <token> for Ordering endpoints.

For production-grade OAuth2/OIDC, swap Identity.API for OpenIddict or Duende IdentityServer.

Event flow

  • Ordering publishes OrderCreated
  • Payment consumes OrderCreated → publishes PaymentSucceeded or PaymentFailed
  • Notification consumes payment events

Folder layout

See src/ for services and BuildingBlocks/ for shared infrastructure.

About

Dockerized .NET 8 microservices e-commerce backend with API Gateway, RabbitMQ messaging, JWT auth, and multi-database architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published