An ASP.NET Core minimal API starter in C# on .NET 8 for .NET developers who want a small web service to rename and extend. It includes grouped endpoints, the options pattern, a health check with uptime, open CORS, xUnit tests and a two-stage Dockerfile.
by Light CloudREST APIs
Program.cs binds Kestrel to 0.0.0.0 and the port in PORT, registers ApiInfoOptions and the Uptime service, and maps the endpoints; handlers receive their dependencies as parameters and return anonymous objects that ASP.NET Core writes as JSON. The first thing most people change is CORS: swap AllowAnyOrigin() for WithOrigins(...) with their frontend's address. The repo also ships a .mcp.json for the Light Cloud MCP server, and Light Cloud builds the Dockerfile and redeploys on each push to your copy.
Add a static class in Endpoints/ with a Map...Endpoints extension method, following RootEndpoints.cs, and call it from Program.cs next to app.MapRootEndpoints().
Join the section and key with a double underscore: Api__Message="Hello" dotnet run overrides Api:Message. Environment variables take priority over the JSON files.
Add the Swashbuckle.AspNetCore package, call builder.Services.AddEndpointsApiExplorer() and builder.Services.AddSwaggerGen(), then app.UseSwagger() and app.UseSwaggerUI(). Swagger UI is then at /swagger.
This starter uses WebApplicationFactory<Program> from Microsoft.AspNetCore.Mvc.Testing, which runs the app in memory and hands the tests an HttpClient. Program.cs ends with public partial class Program so the factory can find it.
Yes. Run the Docker image on any container host, or run dotnet publish DotnetApi.csproj -c Release -o out and start dotnet out/DotnetApi.dll on a server with the ASP.NET Core 8 runtime.
Start a C# CRUD API on PostgreSQL with ASP.NET Core minimal APIs, Npgsql and OpenAPI
Start a Java REST API with Spring Boot, input validation and problem JSON errors
Deploy an app in any language: bring a Dockerfile that listens on PORT