Skip to content

Getting started with Fast.NET

This guide covers the shortest path from selecting modules to running an application. See the module guide for package boundaries and configuration entry points.

Prerequisites

  • Consumer applications target .NET 8, .NET 9, or .NET 10.
  • Building the Fast.NET source repository requires the .NET 10 SDK selected by its global.json.
  • Redis, Consul, and databases are required only by their corresponding modules. Basic SDK setup has no external service dependency.

Create an application

bash
dotnet new webapi -n MyFastApp -f net10.0
cd MyFastApp
dotnet add package Fast.NET.Core --version 3.5.38
dotnet add package Fast.Serialization.System.Text.Json --version 3.5.20
dotnet add package Fast.Swagger --version 3.5.34

Most applications choose either Fast.Serialization.System.Text.Json or Fast.Serialization.Newtonsoft.Json. Do not install every Fast.NET package for a single capability.

Minimal setup

csharp
using Fast.NET.Core;
using Fast.Serialization;
using Fast.Swagger;

var builder = WebApplication.CreateBuilder(args);

builder.Initialize();
builder.Services.AddSerialization();
builder.Services.AddControllers();
builder.Services.AddSwaggerDocuments(builder.Configuration);

var app = builder.Build();

app.UseSwaggerDocuments();
app.MapControllers();
app.MapGet("/health", () => Results.Ok(new {status = "ok"}));

app.Run();

appsettings.json:

json
{
	"SwaggerSettings": {
		"Enable": true,
		"DocumentTitle": "My Fast.NET API",
		"EnableAuthorized": false
	}
}

When using Fast.DynamicApplication, call AddControllers() or AddControllersWithViews() before AddDynamicApplication().

Build from source

Run the following commands from the Fast.NET source repository root. Documentation maintenance does not automatically run these commands or start the resulting application.

bash
dotnet restore Fast.NET.sln
dotnet build Fast.NET.sln -c Release --no-restore
dotnet pack Fast.NET.sln -c Release --no-build --no-restore -p:WarnOnPackingNonPackableProject=false

On Windows, restore, build, and pack through the single repository entry point:

bat
UploadNuget.bat pack

The batch file always builds before packing and doesn't publish in pack mode. Packages are written to nupkgs/; see the release guide for optional all-package or single-package publishing.

Next steps

Example compilation

The documentation example compilation baseline targets net8.0;net9.0;net10.0 and pins Fast.NET.Core 3.5.38, Fast.Serialization.System.Text.Json 3.5.20 and Fast.Swagger 3.5.34.

bash
dotnet restore
dotnet build -c Release --no-restore

Run the commands above from your own application project, using the pinned references above. The project is compiled only; it is not started by documentation checks. These commands were not run during the current read-only audit and module documentation update. New snippets in other module pages are outside this project's compilation scope.