ASP.NET Core › Controllers vs Minimal APIs

How would you migrate an existing controller-based API to minimal APIs incrementally without a risky big-bang rewrite?

Advanced

Answer

A safe incremental approach: start by migrating simple, low-risk, low-traffic endpoints (like health checks or read-only reference data endpoints) first to build team familiarity, extract shared cross-cutting logic (validation, error handling) into reusable endpoint filters mirroring existing controller filter behavior, migrate remaining endpoints feature-by-feature (grouping related endpoints together to migrate as a cohesive unit rather than piecemeal), and maintain both styles coexisting in the same application throughout the transition, only removing the old controllers once each area's minimal API replacement has been validated in production.
// Phase 1: migrate simple endpoints first
app.MapGet("/health", () => Results.Ok());  // low-risk, migrated first

// Phase 2 (later): migrate a full feature area together
app.MapProductEndpoints();  // entire Products feature migrated as a cohesive unit

// Old ProductsController removed only after MapProductEndpoints is validated in production
Real-world example A team migrates their 80-endpoint controller-based API to minimal APIs over three months, starting with five low-risk read-only endpoints, then tackling one full feature area (Products, then Orders, then Customers) at a time, keeping both styles running side-by-side throughout.

Common follow-ups: What metrics would you track to validate each migrated feature area before removing the old controller?;How do you handle shared cross-cutting concerns (like a custom filter) that need to work identically in both styles during the transition?