Microservices & System Design with .NET
Decide the style
Modular monolith by default → extract a service only for independent scaling, release cadence, ownership or technology. Split by business capability (bounded context), never by technical layer.
Communication
| Need | Use |
|---|---|
| Public/browser API | REST + OpenAPI via gateway |
| Fast internal call | gRPC |
| "Do this later" | Queue (command) |
| "This happened" | Topic/pub-sub (event) |
| High-volume stream / replay | Kafka / Event Hubs |
Consistency toolbox
Local transaction per aggregate · saga (choreography/orchestration) with compensations · transactional outbox · idempotent consumer / inbox · idempotency keys · eventual consistency shown in UI.
Resilience toolbox
Timeout · retry + backoff + jitter (idempotent only) · circuit breaker · bulkhead · fallback · health checks (live/ready) · DLQ. .NET: AddStandardResilienceHandler().
Observability
Logs + metrics + traces via OpenTelemetry; correlation/trace id everywhere; golden signals: latency, traffic, errors, saturation; .NET Aspire dashboard locally, App Insights/Grafana in production.
System design template
Requirements → estimates → API → data model → diagram → deep dive → bottlenecks & failures → trade-offs. Always mention cache, queue, replicas, idempotency and monitoring.