Lesson 8 of 9
Capstone Project: Full Stack E-Commerce API
Build and deploy a complete E-Commerce API combining every module: Clean Architecture, DDD Order aggregate, JWT auth with refresh rotation, EF Core with migrations, Redis caching, Hangfire jobs, SignalR tracking, GitHub Actions CI/CD, Docker, K8s health checks, Prometheus metrics - production-ready from day one.
Quick Quiz - Docker, CI/CD & Production Deployment
Complete System Architecture
// ━━ Full E-Commerce API - architecture overview ━━
// TECH STACK
// ├── ASP.NET Core 8 API → Minimal APIs + Controllers
// ├── EF Core 8 + SQL Server → Persistence (AddDbContextPool)
// ├── Redis → Distributed cache + SignalR backplane
// ├── Azure Blob Storage → Product images
// ├── Azure Key Vault → Production secrets
// ├── Hangfire + SQL Server → Background jobs (emails, reports)
// ├── SignalR → Real-time order tracking
// ├── Prometheus + Grafana → Metrics and dashboards
// └── Serilog + Azure Monitor → Structured logging
// ARCHITECTURE
// ├── MyApp.Domain/ → Order, Product, Customer aggregates + Money VO
// ├── MyApp.Application/ → CQRS: PlaceOrder, GetProducts, ... + MediatR behaviors
// ├── MyApp.Infrastructure/ → EF Core, Redis, Hangfire, SignalR, Blob
// └── MyApp.Api/ → Minimal API endpoints, JWT auth, middleware
// KEY FLOWS
// 1. User Registration
// POST /api/auth/register → ASP.NET Identity → Hangfire: SendWelcomeEmail → 201
// 2. Product Catalog
// GET /api/v1/products → Output Cache (5min) → EF Core AsNoTracking projection
// GET /api/v1/products/:id → Redis GetOrSetAsync → Compiled EF Core query
// 3. Place Order
// POST /api/v1/orders → JWT auth → FluentValidation → PlaceOrderCommand
// → MediatR pipeline: Logging → Validation → Handler
// → Order.Place() → OrderPlacedEvent
// → DomainEventBehavior: EmailHandler (Hangfire) + SignalRHandler + InventoryHandler
// → Response: 201 Created in ~50ms
// 4. Real-time tracking
// WS /hubs/orders → OrderTrackingHub → Groups["order:id"]
// When order ships: OrderShippedEvent → SignalRHandler → hub.Group("order:id").OrderStatusUpdated(...)
// 5. Daily report
// Hangfire Cron: daily 6am UTC → GenerateDailySalesReport → Save to Blob → Email PDF to admins
// DEPLOYMENT
// GitHub Actions: push to main →
// build + test → docker build → push to ACR →
// kubectl apply → Rolling deployment →
// Smoke tests → Slack notification
// MONITORING
// Prometheus: request rate, p99 latency, order rate, error rate, queue depth
// Grafana: real-time dashboards with SLO alerts
// Seq: query structured logs by UserId, OrderId, CorrelationId
// Azure Application Insights: end-to-end distributed tracing
// RUNNING LOCALLY - one command
// docker compose up → API + SQL Server + Redis + Seq + Hangfire Dashboard
// dotnet watch run → hot reload during development
// open http://localhost:8080/swagger → Swagger UI
// open http://localhost:5342 → Seq log viewer
// open http://localhost:8080/hangfire → Hangfire dashboard (Admin only)
// open http://localhost:9090/metrics → Prometheus metrics raw
// WHAT YOU'VE MASTERED (Modules 1-12):
// M1: C# 12, records, pattern matching, async, LINQ
// M2: DI lifetimes, IOptions, BackgroundService, Channel queue
// M3: Middleware pipeline, CorrelationId, GlobalExceptionHandler, CORS, rate limiting
// M4: Minimal vs Controller APIs, routing, API versioning, Swagger
// M5: EF Core pooling, Fluent API, migrations, N+1/AsSplitQuery, bulk ops, transactions
// M6: Repository, Unit of Work, AutoMapper, FluentValidation, MediatR CQRS
// M7: JWT auth, refresh rotation, ASP.NET Identity, 2FA, Google OAuth
// M8: Policy-based auth, OWASP, Data Protection, CSP, antiforgery, rate limiting
// M9: xUnit, Moq, WebApplicationFactory, TestContainers, Coverlet, builders
// M10: Serilog, Redis cache, Output Cache, IHttpClientFactory, Polly, Prometheus
// M11: Clean Architecture, DDD aggregates, full MediatR pipeline, Hangfire, SignalR
// M12: Docker multi-stage, docker-compose, GitHub Actions, K8s, graceful shutdown
Console.WriteLine("You are now a production-grade ASP.NET Core backend engineer. Ship it!");Tip
Tip
Practice Capstone Project Full Stack ECommerce API in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
.NET provides a unified platform for building various application types
Practice Task
Note
Practice Task - (1) Write a working example of Capstone Project Full Stack ECommerce API from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Common Mistake
Warning
A common mistake with Capstone Project Full Stack ECommerce API is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready dotnet code.
Finished this lesson?