Suwbackkit.Server 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Suwbackkit.Server --version 0.2.1
                    
NuGet\Install-Package Suwbackkit.Server -Version 0.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Suwbackkit.Server" Version="0.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Suwbackkit.Server" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Suwbackkit.Server" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Suwbackkit.Server --version 0.2.1
                    
#r "nuget: Suwbackkit.Server, 0.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Suwbackkit.Server@0.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Suwbackkit.Server&version=0.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Suwbackkit.Server&version=0.2.1
                    
Install as a Cake Tool

Suwbackkit.Server

Server defaults for the ASP.NET Core backends of Manomenu's apps, in two calls, the way .NET Aspire's ServiceDefaults does it:

  • Logging: JSON on the console, with scopes and UTC timestamps; Microsoft.AspNetCore at Warning. These are the lowest-priority configuration values, so appsettings.json or environment variables override any of them (Logging__Console__FormatterName=simple).
  • ProblemDetails: every error is application/problem+json with a traceId (the W3C trace id the logs carry in their scope), from unhandled exceptions (UseExceptionHandler) and from empty error responses such as 404 (UseStatusCodePages).
  • OpenAPI: AddOpenApi with the document pinned to OpenAPI 3.1, so a newer .NET does not change the contract on its own. The pin holds for the document served at run time and for the one Microsoft.Extensions.ApiDescription.Server writes at build time: the build ignores OpenApiOptions, so the package also adds --openapi-version OpenApi3_1 to OpenApiGenerateDocumentsOptions, unless the app's project already names a version there. An app adds its own options with another AddOpenApi(...) call.
  • Health checks: /health runs every check (503 when one fails), /alive only the liveness ones (the process answers); both stay out of the OpenAPI document and answer without credentials (AllowAnonymous), also in an app whose other endpoints ask for them. Other packages add their checks with AddHealthChecks(), as Suwbackkit.Postgres does.
  • Contract schemas (opt-in): AddOpenApi(options => options.AddContractSchemas()) makes every schema say what the JSON always holds, so the types an app generates from the document (openapi-typescript) need no ? or | null where the server never leaves a value out: a property the server always writes and never as null (a get-only property of a non-null reference type, which ASP.NET Core leaves optional and nullable) is required and not nullable; a union's discriminator ([JsonPolymorphic]) is required in each of its variants; and null is no value of an enum (ASP.NET Core adds it to an enum used only as a nullable property, whose property already says null).
  • /api/health in the contract: MapHealthStatus() on a route group maps GET <group>/health, answering {"status":"ok"}, or 503 ProblemDetails naming the failed checks; it answers without credentials too.

Usage

using Suwbackkit.Server;

var builder = WebApplication.CreateBuilder(args);
builder.AddServerDefaults();

var app = builder.Build();
app.MapServerDefaults();
app.MapGroup("/api").MapHealthStatus();
app.Run();

With the contract schemas, and the app's own OpenAPI options beside them:

builder.Services.AddOpenApi(options => options.AddContractSchemas());

Call MapServerDefaults() right after Build(): it puts the exception handler first in the pipeline.

ServerDefaults.WritingOpenApiDocument is true while the build-time OpenAPI generator (GetDocument.Insider) runs the app only to read its routes: skip anything that needs the outside world then, such as migrations or background workers.

builder.Services.AddDatabase(builder.Configuration, migrateOnStart: !ServerDefaults.WritingOpenApiDocument);

ServerKit.Version is the version of this package, for an app that logs which kit it runs.

Source, license and changes: https://github.com/Manomenu/suwbackkit

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.5.2 80 11/22/2026
0.5.1 78 11/22/2026
0.5.0 77 11/21/2026
0.4.0 101 11/21/2026
0.3.0 66 11/21/2026
0.2.2 56 11/21/2026
0.2.1 49 11/21/2026
0.2.0 46 11/20/2026
0.1.0 128 11/20/2026