BrainFeed Solutions
Book a call

ASP.NET Core Web API: the design decisions we make on every new backend

Minimal APIs or controllers, versioning, JWT auth, ProblemDetails, EF Core vs Dapper, logging and tests: what we pick on a new ASP.NET Core Web API, and why.

BrainFeed · 5 min read · 2 December 2026

ASP.NET Core Web API: seven design decisions, settled before the first endpoint ships

Every new ASP.NET Core Web API starts with the same handful of questions. None of them is hard on its own. The trouble is that they get answered by default, on day one, and then you live with the answers for years.

Here are the seven we settle before the first endpoint ships, what we pick, and the reasoning. They are our defaults, not rules. Each has a point where we'd choose differently, and we say where.

1. Minimal APIs or controllers

We pick minimal APIs for most new services, and controllers when the surface is large or the team is used to them.

Minimal APIs mean less ceremony: a route, a handler, a typed result. For a service with a focused set of endpoints, that's easier to read and quicker to change. Group endpoints by feature with MapGroup, return TypedResults so the response types show up in OpenAPI, and keep handlers thin.

Controllers still earn their place. If you have a hundred-plus endpoints, a team that already knows MVC conventions, or heavy use of filters and model binding customisation, controllers give you structure you'd otherwise rebuild by hand. Both run on the same pipeline, so this is a style choice and not a performance one. Pick one per service and stay consistent.

2. Versioning from day one

We pick URL-segment versioning (/v1/orders) with the Asp.Versioning packages, and we add it before the first release.

Retrofitting versioning onto an API that already has consumers is painful, because every existing client is implicitly "version zero". Adding /v1 at the start costs almost nothing.

URL segments are boring and visible: you can see the version in logs, in a browser and in a support ticket. Header-based versioning is cleaner in theory, but it's harder to debug and easy to forget in a client. We deprecate by announcing a sunset date and keeping the old version running until usage drops, not by editing a version in place.

3. Authentication: JWT bearer against a real identity provider

We pick JWT bearer authentication validated against an OpenID Connect provider, and we don't write our own token issuing.

Use the Microsoft.AspNetCore.Authentication.JwtBearer handler, point it at the provider's authority, and validate issuer, audience and lifetime. Keep signing keys out of the codebase; the provider publishes them and the handler fetches them.

Building your own login, password storage and token issuing is where backends pick up their worst security problems. If the API is the only consumer and there is no identity provider yet, we'd rather stand up a managed one than hand-roll it. Authorise with policies (RequireAuthorization("orders:write")) rather than scattering role checks through handlers.

4. Validation and errors: one error shape, everywhere

We pick ProblemDetails for every error response, with validation done before the handler runs.

Clients shouldn't have to learn a different error format for each endpoint. ASP.NET Core supports the Problem Details format (application/problem+json, now RFC 9457, which replaced RFC 7807) out of the box: call AddProblemDetails(), and register an IExceptionHandler so unhandled exceptions become a consistent 500 with a trace ID, not a stack trace.

For validation we use FluentValidation, wired in as an endpoint filter or a pipeline step, returning a 400 with field-level errors in the same ProblemDetails shape. .NET 10 also adds built-in validation for minimal APIs (call AddValidation() and use DataAnnotations attributes), which is worth evaluating if you'd rather avoid the extra package. Whichever you choose, never leak internal exception messages to the caller.

5. Data access: EF Core by default, Dapper where it matters

We pick EF Core as the default and reach for Dapper on specific read-heavy paths.

If you're weighing EF Core vs Dapper, the honest answer is that most services need both ideas at different times. EF Core gives you migrations, change tracking and LINQ, which removes a lot of repetitive code and keeps schema changes under version control. That's the right trade for the bulk of a business API.

Dapper is a thin layer over SQL. It's the better fit for reporting queries, bulk reads or any path where you want to see and control the exact SQL. Our rule: start with EF Core, use AsNoTracking() for reads, measure, and only drop to Dapper where a profiler tells you to. Don't choose Dapper "for speed" before you have a slow query.

6. Logging and observability

We pick structured logging through ILogger and OpenTelemetry for traces and metrics, exported over OTLP.

Plain-text logs don't scale past a single server. Structured logs with named properties ({OrderId}, {CustomerTier}) can be searched and aggregated. OpenTelemetry's ASP.NET Core and HttpClient instrumentation gives you request traces and dependency timings without hand-written timing code, and the trace ID can go straight into your ProblemDetails responses so a user's error report points to an exact request.

Add a health-check endpoint at the start, too. Orchestrators and uptime monitors need it, and it's far easier to add before anything depends on its absence.

7. Tests: a few unit tests, many integration tests

We pick integration tests through WebApplicationFactory as the backbone, with unit tests for real business logic.

For an API, the valuable question is "does this request return the right response?" WebApplicationFactory boots the real app in-process, so a test can send an HTTP request through routing, auth, validation and the handler.

Run those tests against a real database in a container (Testcontainers is the usual tool) rather than the EF in-memory provider, which doesn't behave like a relational database and can hide bugs, such as constraint and query-translation differences. Keep pure unit tests (xUnit) for calculation and rule-heavy code. Run all of it in CI on every pull request.

The common thread

Most of these decisions are about reducing the number of things a new developer has to learn: one error format, one way to authenticate, one place to look for a request's trace. A backend that's predictable is cheaper to change. The same logic applies a level up, to the stack itself: see the stack decisions you can't undo.

If you're planning a new .NET backend, or inheriting one that makes different choices, our .NET development service covers API design, build and handover with the code in your own repository from day one.

FAQ

Are minimal APIs production-ready? Yes. They run on the same ASP.NET Core pipeline as controllers and have been supported since .NET 6.

Should I use EF Core or Dapper? Start with EF Core. Add Dapper for specific queries that you've measured as too slow or too hard to express in LINQ.

How should I version an ASP.NET Core Web API? Use the Asp.Versioning packages, put the version in the URL, and add it before the first public release.

What's the best way to handle errors? Return ProblemDetails (RFC 9457) from every endpoint, with a global exception handler for anything unexpected.

Planning an ASP.NET Core Web API, or unsure about one you've inherited? Talk to us about .NET development.

BrainFeed

BrainFeed Solutions

15 years shipping product. Senior-led teams, AI-augmented delivery, AU & US clients. We write about the things we ship - and the things we wish we hadn't.

Follow BrainFeed

Get new posts the day they go up.

Follow on LinkedInMore articles by BrainFeed  →

Newsletter

Enjoyed this? Get the next one in your inbox.

Two emails a month. Plain-language playbooks. Unsubscribe anytime.

No spam. We respect your privacy — see our Privacy Policy.

Want to apply this to your business?

Book a free 30-min consultation. We'll talk about your specific situation.

Book a free 30-min consultation