Skip to content
Back to Portfolio
Microservices Architecture

AnasShop

A production-grade e-commerce platform built with .NET microservices, SvelteKit, PostgreSQL, OpenSearch, and MinIO — demonstrating distributed systems mastery with comprehensive testing at every layer.

.NET 10SvelteKitPostgreSQLOpenSearchRabbitMQgRPCDockerMinIOPlaywrightxUnit
13
Microservices
100+
API Endpoints
45+
DB Tables
74
Unit Tests
49
Integration Tests
16
E2E Scenarios

Technology stack

Complete technology stack across all layers

Backend
.NET 10API ControllersEF CoreMassTransitgRPCFluentValidationMediatR
Frontend
SvelteKitTypeScriptTailwindCSSshadcn-svelteBits UILucide Icons
Data
PostgreSQLOpenSearchRedisMinIO (S3)
Infrastructure
Docker ComposeYARP GatewayRabbitMQOpenTelemetrySerilog
Patterns
MicroservicesCQRSSaga (Orchestrated)Outbox PatternDomain EventsDatabase-per-Service
Testing
xUnitFluentAssertionsNSubstituteBogusWebApplicationFactoryTestcontainersRespawnMassTransit TestHarnessPlaywright (TypeScript)

Request flow overview

How requests flow from the browser through the system

🖥️
SvelteKit (SSR + CSR)
Server-side rendering, API calls to gateway
HTTPS / REST
🌐
YARP API Gateway
Auth validation, rate limiting, request routing
Route by path prefix
⚡
Microservice (API Controller)
Business logic, validation, database operations
Domain events / gRPC
📨
MassTransit / gRPC
Inter-service communication (async events or sync calls)
Read / Write
🗄️
PostgreSQL / OpenSearch / MinIO
Persistence, search indexing, file storage

Database-per-service principle

Each microservice owns its data. No shared databases.

🔐
Identity
PostgreSQL
5 tables
📦
Catalog
PostgreSQL
5 tables
🔍
Search
OpenSearch
1 tables
🛒
Cart
PG + Redis
2 tables
📋
Order
PostgreSQL
5 tables
💳
Payment
PostgreSQL
3 tables
📊
Inventory
PostgreSQL
4 tables
🔔
Notification
PostgreSQL
3 tables
⭐
Review
PostgreSQL
3 tables
🎟️
Coupon
PostgreSQL
4 tables
❤️
Wishlist
PostgreSQL
2 tables
📈
Analytics
PostgreSQL
4 tables
🖼️
Media
PG + MinIO
2 tables

System architecture

The complete AnasShop platform -- clients, gateway, 13 microservices, and all data stores

Clients
🖥️
Web (SvelteKit)
SSR + CSR
📱
Mobile App
Future
🔌
Third-party API
Webhooks
HTTPS
🚪
YARP API Gateway
:5000 -- SSL termination -- JWT validation -- rate limiting -- request routing
HTTP internal + gRPC
Microservices
🔐
Identity
:5001
📦
Catalog
:5002
🔍
Search
:5003
🛒
Cart
:5004
📋
Order
:5005
💳
Payment
:5006
📊
Inventory
:5007
🔔
Notification
:5008
⭐
Review
:5009
🎟️
Coupon
:5010
❤️
Wishlist
:5011
📈
Analytics
:5012
🖼️
Media
:5013
RabbitMQ (async events)
Data Stores
🐘
PostgreSQL
12 databases
🔎
OpenSearch
Full-text search
⚡
Redis
Cache + sessions
📁
MinIO (S3)
Object storage
🐰
RabbitMQ
Message broker

Infrastructure components

Supporting services that power the microservices ecosystem

🌐
YARP Gateway
Reverse proxy, rate limiting, routing
🐰
RabbitMQ
Message broker (MassTransit)
🐘
PostgreSQL
Database per service (13 instances)
🔎
OpenSearch
Full-text search, faceted navigation
📁
MinIO
S3-compatible object storage
⚡
Redis
Cart caching, session store
🐳
Docker Compose
Local orchestration of all services
📡
OpenTelemetry
Distributed tracing & logging

Communication patterns

gRPC for real-time queries, MassTransit/RabbitMQ for event-driven flows

gRPC (synchronous) -- need answer NOW
🛒 Cart
Get live prices
Catalog 📦
📋 Order
Check & reserve stock
Inventory 📊
📋 Order
Product snapshot
Catalog 📦
Protocol Buffers, ~5ms latency, type-safe contracts, request/response pattern
MassTransit + RabbitMQ (async)
📋 Order
ChargeRequested
Payment 💳
💳 Payment
PaymentSucceeded / Failed
Order 📋
📋 Order
ReserveStock / ReleaseStock
Inventory 📊
📦 Catalog
ProductCreated / Updated / Deleted
Search 🔍
📋 Order
OrderPlaced / Shipped / Delivered
Notification 🔔
💳 Payment
PaymentSucceeded / Failed
Notification 🔔
⭐ Review
RatingAggregateUpdated
Catalog 📦
📊 Inventory
LowStockAlert
Notification 🔔
📦 Catalog
All domain events
Analytics 📈
📋 Order
All domain events
Analytics 📈
Event-driven, fire-and-forget, saga orchestration, outbox pattern, guaranteed delivery

CQRS pattern

Write side processes commands, publishes events. Read side builds optimized query models.

Write side (Command)
SvelteKit
User action
↓
YARP Gateway
Route to service
↓
Catalog Service
EF Core → PostgreSQL
↓
Outbox
Publish domain event
RabbitMQ
MassTransit
events flow →
Read side (Query)
MassTransit Consumer
Process domain event
↓
Search Service
Update OpenSearch index
↓
Analytics Service
Update materialized views
↓
OpenSearch + Read DB
Serve fast queries

Testing pyramid

More unit tests (fast, cheap) -- fewer E2E tests (slow, high confidence)

16
E2E Tests (Playwright + TypeScript)
49
Integration Tests (WebApplicationFactory + Testcontainers)
74
Unit Tests (xUnit + FluentAssertions + NSubstitute)

Tests by service

Unit and integration test counts per microservice

Unit tests by service
🔐 Identity
8
📦 Catalog
8
🔍 Search
5
🛒 Cart
6
📋 Order
8
💳 Payment
5
📊 Inventory
6
🔔 Notification
4
⭐ Review
5
🎟️ Coupon
6
❤️ Wishlist
4
📈 Analytics
4
🖼️ Media
5
Integration tests by service
🔐 Identity
5
📦 Catalog
5
🔍 Search
4
🛒 Cart
4
📋 Order
5
💳 Payment
4
📊 Inventory
4
🔔 Notification
3
⭐ Review
3
🎟️ Coupon
3
❤️ Wishlist
3
📈 Analytics
3
🖼️ Media
3

Playwright E2E tests

TypeScript-based E2E tests -- click each category to explore test files, steps, and assertions

CI test pipeline

Azure DevOps pipeline runs all test layers on every PR

1
Build
dotnet build + npm ci
~40s
2
Unit tests
dotnet test --filter Category=Unit
~15s
3
Integration tests
Testcontainers spin up → test → teardown
~2min
4
E2E tests
npx playwright test --workers=4
~4min
Gate policy: PR merge blocked if any test layer fails. Unit tests run first (fast feedback). Integration and E2E run in parallel to minimize total pipeline time (~4 minutes).