Skip to main content

Lesson 7 of 9

Production Readiness Checklist

Before going live, audit your API against this checklist. Every item has a reason - skipping 'Content-Security-Policy' leaves users vulnerable to XSS; skipping 'AsNoTracking' causes memory leaks under load.

20 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Production Launch Checklist

Production Launch Checklist
// ━━ SECURITY ━━
// ✅ HTTPS enforced everywhere (UseHsts + UseHttpsRedirection)
// ✅ JWT: 15-minute access tokens, 7-day refresh tokens in httpOnly cookies
// ✅ Refresh token rotation with family-based replay detection
// ✅ Secrets in Azure Key Vault - ZERO secrets in appsettings.json or git
// ✅ CORS: explicit origin allowlist, no wildcard in production
// ✅ Rate limiting per IP and per user
// ✅ Security headers: X-Content-Type-Options, X-Frame-Options, CSP
// ✅ OWASP: parameterized SQL, no mass assignment, SSRF allowlist
// ✅ HTML sanitization for user-generated rich text
// ✅ [ApiController] automatic 400 for invalid models

// ━━ PERFORMANCE ━━
// ✅ AsNoTracking() on all read queries
// ✅ AsSplitQuery() on multi-Include queries
// ✅ Compiled queries for hot paths
// ✅ Indexes on filter columns (FK, search fields, cursor pagination field)
// ✅ DbContextPool (AddDbContextPool not AddDbContext)
// ✅ Redis distributed cache with GetOrSetAsync
// ✅ Output Cache on public list endpoints
// ✅ Brotli/Gzip response compression enabled

// ━━ OBSERVABILITY ━━
// ✅ Serilog JSON structured logging → Elasticsearch/Seq
// ✅ CorrelationId enricher - trace requests across microservices
// ✅ Prometheus /metrics endpoint - Grafana dashboards
// ✅ Health checks: /health/live and /health/ready with tags
// ✅ Slow query interceptor - log DB queries > 500ms
// ✅ Request timing logged via UseSerilogRequestLogging

// ━━ RELIABILITY ━━
// ✅ IHttpClientFactory typed clients with Polly retry + circuit breaker
// ✅ EnableRetryOnFailure on EF Core (transient SQL errors)
// ✅ Explicit CancellationToken on all async methods
// ✅ Graceful shutdown (ShutdownTimeout = 30s)
// ✅ Hangfire persistent jobs (emails, reports) - survive restart
// ✅ BackgroundService error handling - catch and continue

// ━━ ARCHITECTURE ━━
// ✅ Clean Architecture: Domain zero external deps
// ✅ No business logic in controllers (service layer or CQRS handlers)
// ✅ Repository/UnitOfWork for data access
// ✅ FluentValidation on all commands
// ✅ Result<T> returns instead of exceptions for business failures
// ✅ API versioning via route prefix (/api/v1, /api/v2)

// ━━ DEPLOYMENT ━━
// ✅ Multi-stage Docker build → Alpine runtime image
// ✅ Non-root container user (UID 1001)
// ✅ Health checks in Dockerfile HEALTHCHECK instruction
// ✅ GitHub Actions: build → test → push → deploy
// ✅ Migrations run before deployment (not inside running API pods)
// ✅ Kubernetes: HPA for auto-scaling, PDB for availability
// ✅ Azure Key Vault with managed identity (no stored credentials)

// ━━ TESTING ━━
// ✅ Unit tests for all services (Moq + FluentAssertions)
// ✅ Integration tests via WebApplicationFactory (real HTTP)
// ✅ TestContainers for DB constraint tests
// ✅ 80%+ code coverage enforced in CI
// ✅ NetArchTest enforcing Clean Architecture dependency rules

Console.WriteLine("System is production ready!");

Tip

Tip

Practice Production Readiness Checklist in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.

Diagram
Loading diagram…

Visual architecture and concepts for Production Readiness Checklist

Practice Task

Note

Practice Task - (1) Write a working example of Production Readiness Checklist 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.

Quick Quiz

Common Mistake

Warning

A common mistake with Production Readiness Checklist is skipping edge case testing - empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready dotnet code.

Topics in This Module

0/9 done