Sharkable 0.3.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Sharkable --version 0.3.1
                    
NuGet\Install-Package Sharkable -Version 0.3.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="Sharkable" Version="0.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sharkable" Version="0.3.1" />
                    
Directory.Packages.props
<PackageReference Include="Sharkable" />
                    
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 Sharkable --version 0.3.1
                    
#r "nuget: Sharkable, 0.3.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 Sharkable@0.3.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=Sharkable&version=0.3.1
                    
Install as a Cake Addin
#tool nuget:?package=Sharkable&version=0.3.1
                    
Install as a Cake Tool

Sharkable

a dotnet minimal api framework collection

Usage

automatic dependency injection

//first add extension
using Sharkable
builder.Services.AddShark();
//for aot users please specify assemblies by youself and avoid code trim
build.Services.AddShark([typeof(Program).Assembly]);

[ScopedService] //inject class as a scoped service by the given attribute
public class Monitor : IMonitor
{
    public void Show()
    {
        ...
    }
}

//map an endpoint and it works!
app.MapGet("/monitor",([FromServices]IMonitor monitor) =>
{
    monitor.Show();
});

endpoint auto mapper (new style)

create a new class

public class TestEndpoint : ISharkEndpoint
{
    public void AddRoutes(IEndpointRouteBuilder app)
    {
        app.MapGet("show", ()=>"test result");
    }
}

//will now generate a http get method with the url
// api/test/show

endpoint auto mapper (old style)

create a new class

[SharkEndpoint]
public class TestEndpoint
{
    [SharkMethod("show", SharkHttpMethod.GET)]
    public void Show()
    {
        ...
    }
}

//will now generate a http get method with the url
// api/test/show

idempotent retries via Idempotency-Key

opt-in middleware that lets clients safely retry unsafe HTTP requests. when a client sends the Idempotency-Key header on a POST / PUT / PATCH / DELETE request, the first response is cached; subsequent requests with the same key replay it. reusing a key with a different payload returns 422; concurrent same-key requests return 409 with Retry-After: 1.

builder.Services.AddShark(opt =>
{
    opt.EnableIdempotency = true;
    opt.ConfigureIdempotency(o =>
    {
        o.Ttl = TimeSpan.FromHours(24);  // default
        o.MaxResponseSize = 1_048_576;   // default 1 MiB
    });
});

see docs/superpowers/specs/2026-06-26-idempotency-middleware-design.md for the full specification including edge cases and limitations.

for more use sample please see Sharkable.Sample project

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

Showing the top 2 NuGet packages that depend on Sharkable:

Package Downloads
Sharkable.AutoCrud.SqlSugar

AutoCrud SqlSugar plugin for Sharkable — automatic CRUD API generation with health check

Sharkable.Cache.Redis

Redis-backed distributed stores for Sharkable — idempotency and rate limiting.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.7 40 7/11/2026
0.5.6 149 7/3/2026
0.5.5 153 7/2/2026
0.5.4 136 7/1/2026
0.5.3 149 6/30/2026
0.5.2 94 6/30/2026
0.5.1 106 6/29/2026
0.4.1 143 6/28/2026
0.4.0 131 6/28/2026
0.3.2 93 6/27/2026
0.3.1 147 6/27/2026
0.2.0 109 6/8/2026
0.1.0 108 6/8/2026
0.0.24 284 10/2/2024
0.0.23 254 9/27/2024
0.0.21 218 9/25/2024
0.0.20 212 9/24/2024
Loading failed