CleanWebApi.Template 2026.12.2.229

Prefix Reserved
dotnet new install CleanWebApi.Template@2026.12.2.229
                    
This package contains a .NET Template Package you can call from the shell/command line.

Clean Web API

A dotnet new template for an HTTP API using ASP.NET Core controllers in .NET 10, built with a streamlined Clean Architecture. All the layers you need, none of the ceremony you don't.

It's one of five Lean Mean Clean Apps templates, for Minimal APIs, Model Context Protocol, GraphQL, Web API controllers and AWS Lambda. They share the same Application and Infrastructure layers and differ only in how they face the world. The full docs live at leanmeanclean.dev/webapi.

Template Presentation Package Docs
Clean Minimal API ASP.NET Core Minimal APIs CleanMinimalApi.Template Docs
Clean Model Context Protocol Model Context Protocol server CleanModelContextProtocol.Template Docs
Clean GraphQL API GraphQL with Hot Chocolate CleanGraphQLApi.Template Docs
Clean Web API ASP.NET Core controllers, you are here CleanWebApi.Template Docs
Clean Lambda Function AWS Lambda CleanLambdaFunction.Template Docs

Get started

You need the .NET 10 SDK. Docker is optional, but it's the quickest way to see it running.

# Install the template
dotnet new install CleanWebApi.Template

# Create a solution
dotnet new cleanwebapi --name WorksOnMyMachine.Movies --authorName "Your Name"
cd WorksOnMyMachine.Movies

cleancontrollers works too, for anyone who'd rather not type cleanwebapi every time, and so do lmca-webapi and leanmeancleanapps-webapi. dotnet new search leanmeanclean lists the whole family.

Option Short Default What it does
--name -n The folder's name Names the solution and its root namespace
--authorName -an Stephen Walsh Puts your name on the assembly instead of ours
--include-auth Off Adds JWT bearer token authentication. Leave it out and the API has no auth code at all
--authority -iss Empty Your OAuth authorization server. Required with --include-auth
--audience -aud Empty The audience tokens must be issued for, usually the API's own URL. Only used with --include-auth
--no-restore Off Skips the package restore that normally runs once the solution is created

Rather click than type? Visual Studio and Rider show the same options in their new project dialogs. They always show the authority and audience fields, but only use them when Include authentication is ticked. In the terminal, dotnet new cleanwebapi --help lists them all.

Run it

# Build the image and start it with sample data, plus a collector and the Aspire dashboard for its telemetry
docker compose up -d --build

# Ask it for a page of movies
curl "http://localhost:7340/api/movies?query=space&limit=2"

# Run the tests while you're here
dotnet test

Then open Scalar at http://localhost:7340/scalar to browse and try every endpoint.

The API is open unless you create it with --include-auth --authority (and usually --audience), and then it asks for a JWT bearer token. Leave --include-auth out and there's no auth code at all.

What's inside

  • Presentation: the HTTP API, with a controller per feature, documented for Scalar from XML comments
  • Application: commands and queries through Mediator, validated by FluentValidation and mapped by Mapperly
  • Infrastructure: Entity Framework Core on SQLite, with optional sample data
  • Tests: xUnit, Shouldly and NSubstitute, each on its own throwaway database
  • Extras: OpenTelemetry traces, metrics and Serilog logs over OTLP, health checks, a Dockerfile that runs as a non-root user, Docker Compose, and a GitHub Actions pipeline that won't let your coverage slip

Releases

A new version lands on the 1st of each month, as long as something changed. No changes, no release. We're not here to pad the download stats.

dotnet new update

More help

Who built this

Built by Stephen Walsh in spare time, with strong coffee and a healthy disregard for pomp and ceremony. If this template saves you some time, sponsoring the work keeps all five templates current and the coffee flowing.

  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.12.2.229 58 12/2/2026
2026.11.1.122 172 11/1/2026
2026.10.29.102 149 10/29/2026
2026.10.29.93 142 10/29/2026
2026.10.28.86 150 10/28/2026
2026.10.28.84 141 10/28/2026
2026.10.28.79 136 10/28/2026
2026.10.28.77 131 10/28/2026
2026.10.28.75 143 10/28/2026
2026.10.28.71 134 10/28/2026
2026.10.28.66 135 10/28/2026
2026.10.27.64 141 10/27/2026
2026.10.27.62 131 10/27/2026
2026.10.27.59 134 10/27/2026
2026.10.27.56 129 10/27/2026
2026.10.27.49 136 10/27/2026
2022.9.25.19 1,265 9/25/2022
2022.9.18.18 1,112 9/18/2022
2022.9.11.17 1,081 9/11/2022
2022.9.4.16 1,084 9/4/2022
Loading failed