Fusion-Framework 2.0.1

dotnet add package Fusion-Framework --version 2.0.1
                    
NuGet\Install-Package Fusion-Framework -Version 2.0.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="Fusion-Framework" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fusion-Framework" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Fusion-Framework" />
                    
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 Fusion-Framework --version 2.0.1
                    
#r "nuget: Fusion-Framework, 2.0.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 Fusion-Framework@2.0.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=Fusion-Framework&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Fusion-Framework&version=2.0.1
                    
Install as a Cake Tool

Fusion Framework (C#)

Minimal managed bindings over the Rust core via fusion-ffi. DX mirrors Python/Node: FusionApp, [Route], middleware, Status, Settings, Swagger.

/swagger is on by default. Route Version values (for example v1) each get their own OpenAPI spec and appear in the Swagger navbar.

Prerequisites

Requires .NET 8+ (this package targets net10.0 by default; retarget as needed).

dotnet add package Fusion-Framework

NuGet package id is Fusion-Framework; the C# namespace remains FusionFramework.

Native fusion-ffi is packed under runtimes/<rid>/native/ in the NuGet package. For local development from this repo:

# from repo root
cargo build -p fusion-ffi
# optional: export FUSION_FFI_PATH=$PWD/target/debug/libfusion_ffi.so
dotnet build bindings/csharp/FusionFramework

Quick start

using FusionFramework;

[Route("api/[module]", Version = "v1", Tags = new[] { "products" })]
public class ProductModule : FusionBaseApi
{
    public object Get() =>
        Response(new { products_id = 12 }, Status.HTTP_SUCCESS);
}

var MIDDLEWARE = new List<FusionMiddleware>(); // none by default

Route.Register<ProductModule>();
SettingsStore.Current.EnsureLoaded(Directory.GetCurrentDirectory());
var app = new FusionApp(SettingsStore.GetSettings());
foreach (var mw in MIDDLEWARE) app.Use(mw);
app.Listen();

Auto-reload (development)

// Restart the process when source files change
app.Listen(reload: true);

// Never reload (default) — same as omit / settings reload: false
app.Listen(reload: false);

Or in fusion.dev.json:

{ "reload": true }

Custom HTTP routes

Use method-level attributes alongside convention get/post/… handlers:

[Route("/api/[module]")]
public class UserModule : FusionBaseApi
{
    public object Get() => Response(new { mode = "convention" });

    [HttpGet("test/[action]")]
    public object UserAction() => Response(new { mode = "custom" });
}

Pagination

List endpoints can use PageParams() / Paginated() on FusionBaseApi:

public object Get()
{
    var p = PageParams(page: 2, pageSize: 10);
    var items = FetchItems((int)p.Offset, (int)p.Limit);
    return Paginated(items, total: 100, p);
}

Query params: page, page_size (aliases: per_page, limit), optional offset.

[action] becomes the handler name without an Action suffix, lowercased (UserAction → user).

Handler parameters

Handler method parameters are bound automatically (Python parity):

  • GET (and other reads): from query string — Get(string name) → ?name=alice
  • POST/PUT/PATCH: from JSON body — Post(string name) → { "name": "alice" }
  • Path tokens {id}: from route params

Parameters appear in Swagger OpenAPI docs.

MIDDLEWARE.Add(Middleware.BearerJwt());
Route.Register(typeof(AdminModule), "/api/admin", permissions: new[] { AdminChecks.IsAdmin });

Static files

Serve CSS/images without custom routes (WhiteNoise-style).

  • root: folder on disk (e.g. static)
  • prefix: URL prefix (e.g. /static)

So static/logo.png is available at /static/logo.png:

app.Use(Middleware.StaticFiles(root: "static", prefix: "/static"));
// <img src="/static/logo.png">

Use prefix: "/" when files should be served at the site root (templates/home/a.png → /a.png). Files are mounted as real routes on FusionApp.Mount() / Listen().

Cache

Process-wide cache (default driver moka). Configure via cache in fusion.<env>.json.

Cache.Set("user:1", new { name = "Ada" }, ttlSeconds: 60);
var value = Cache.Get("user:1");
Cache.GetOrSet("counter", 1);
Cache.ExistsOrSet("flag", true);
Cache.DeleteOrSet("user:1", new { name = "Bob" });
Cache.Clear();
await Cache.SetAsync("user:2", new { name = "Ada" });
await Cache.ClearAsync();

## Background tasks

```csharp
var id = BackgroundTasks.Spawn(() => Console.WriteLine("done"));
BackgroundTasks.SpawnAfter(1000, () => Console.WriteLine("later"));
BackgroundTasks.Cancel(id);
BackgroundTasks.Status(id); // pending|running|done|cancelled|failed
BackgroundTasks.Snapshot(); // also under Cache.Snapshot()["tasks"]

## License

BSD 3-Clause
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.
  • 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
2.0.1 131 9/9/2026
2.0.0 99 9/8/2026
1.3.0 134 8/29/2026
1.2.6 123 8/27/2026
1.2.5 110 8/27/2026
1.2.4 112 8/27/2026