ASP.NET Core Web API Interview Question #177

How should a large Web API solution be organized?

Senior API Design, Architecture, Scalability & Production Scenarios Senior Advanced

Quick Interview Answer

Organize around responsibilities and business capabilities rather than allowing controllers, entities, and infrastructure code to become tightly coupled. A common design separates API presentation, application use cases, domain rules, and infrastructure integrations.

Detailed Explanation

Organize around responsibilities and business capabilities rather than allowing controllers, entities, and infrastructure code to become tightly coupled. A common design separates API presentation, application use cases, domain rules, and infrastructure integrations.

The exact number of projects is less important than dependency direction. Business logic should not depend directly on controllers, HTTP details, or a specific persistence implementation unless that coupling is intentional.

Code Example

MyApp.Api
MyApp.Application
MyApp.Domain
MyApp.Infrastructure
MyApp.Tests

// Dependencies should point toward stable
// application/domain abstractions.