Skip to content

Knight1987/EComm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Order Management Platform (microservices)

The backend is split into .NET 8 services: Identity (JWT and users), Catalog (products and inventory), Orders (checkout, SignalR, admin, webhooks, internal fulfillment HTTP), Analytics (event ingest), Fulfillment Worker (MassTransit + RabbitMQ), and an optional YARP gateway. The Angular storefront lives under client/ECommerce.Web.

Ports (local development)

Service Port
Identity API 5101
Catalog API 5102
Orders API 5103
Analytics API 5104
YARP gateway 8080
RabbitMQ UI 15672
SQL Server 1433

Prerequisites

Database migrations

Each service owns its SQL Server database. After pulling the repo, apply migrations (from repository root):

dotnet ef database update --project src/Services/ECommerce.Identity.Api --startup-project src/Services/ECommerce.Identity.Api
dotnet ef database update --project src/Services/ECommerce.Analytics.Api --startup-project src/Services/ECommerce.Analytics.Api
dotnet ef database update --project src/Services/ECommerce.Orders.Api --startup-project src/Services/ECommerce.Orders.Api
dotnet ef database update --project src/Services/ECommerce.Catalog.Api --startup-project src/Services/ECommerce.Catalog.Api

To add new migrations after model changes:

dotnet ef migrations add <Name> --project src/Services/<Project> --startup-project src/Services/<Project>

Run services locally (no Docker)

  1. Start SQL Server and RabbitMQ (or docker compose up sql rabbitmq using only those services).
  2. Apply migrations (see above).
  3. Start each API and the worker in separate terminals (or your IDE), for example:
dotnet run --project src/Services/ECommerce.Identity.Api
dotnet run --project src/Services/ECommerce.Catalog.Api
dotnet run --project src/Services/ECommerce.Orders.Api
dotnet run --project src/Services/ECommerce.Analytics.Api
dotnet run --project src/Workers/ECommerce.Fulfillment.Worker
dotnet run --project src/Gateway/ECommerce.Gateway

Use the same Jwt:SigningKey (32+ characters), Catalog:InternalApiKey, and Orders:InternalApiKey in Identity, Orders, Catalog, Worker, and gateway-backed clients where applicable. appsettings.json files use aligned demo keys for local development.

Docker Compose (multi-service build)

From the repository root:

docker compose up --build

This builds each service from docker/Dockerfile.web (ASP.NET apps) or docker/Dockerfile.worker (worker runtime image), wires SQL and RabbitMQ, and sets in-cluster URLs (for example Catalog__BaseUrl=http://catalog:8080). The gateway listens on http://localhost:8080 and overrides YARP cluster addresses to Docker DNS names.

Apply EF migrations against the SQL container before or after first boot (the apps call MigrateAsync where migrations exist; ensure migrations have been generated and committed).

Demo tokens (via gateway or Identity directly)

  • Shopper: POST http://localhost:8080/api/auth/demo-token (or port 5101 without gateway)
  • Admin: POST http://localhost:8080/api/auth/admin-demo-token

Angular client

cd client/ECommerce.Web
npm install
npm start

The dev server proxies /api and /hubs to the gateway at http://localhost:8080 (proxy.conf.json).

Internal APIs

  • Catalog inventory: POST /internal/v1/inventory/reserve|release|commit-shipment with header X-Internal-Key.
  • Orders fulfillment (worker): POST /internal/v1/fulfillment/... with X-Internal-Key matching Orders:InternalApiKey.

Azure / production notes

  • Use Azure SQL (or managed SQL) per database; store secrets in Key Vault.
  • Replace RabbitMQ with Azure Service Bus (UsingAzureServiceBus in MassTransit).
  • Use Azure SignalR for scale-out of WebSocket connections.
  • Front traffic with TLS, WAF, and API Management; do not expose internal inventory or fulfillment routes publicly.

About

EComm Assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages