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 web -n MyFastApp -f net10.0
cd MyFastApp
dotnet add package Fast.NET.Core --version 3.5.42
dotnet add package Fast.Serialization.System.Text.Json --version 3.5.21
dotnet add package Fast.Swagger --version 3.5.37

The commands use the NuGet versions verified with the getting-started example. See upgrades and migrations for module version records and migration steps.

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 ​

Replace Program.cs in the web project with the following code.

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();

Merge these settings into the project’s appsettings.json.

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

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

Start and verify ​

Run the following command from the MyFastApp directory:

bash
dotnet run

Send GET /health to the listening address in the startup log. For example, if it shows http://localhost:5000, open http://localhost:5000/health. Expect HTTP 200 with {"status":"ok"}.

To connect a frontend table, build and run the minimal example in the remote pagination guide.

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.42, Fast.Serialization.System.Text.Json 3.5.21 and Fast.Swagger 3.5.37.

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

Run these commands from your application project with the pinned references above. The documentation example passed Release builds for .NET 8, 9 and 10 with zero warnings and errors; the application was not started. New snippets in other module pages are outside this project's compilation scope.