FastSharp.Modules 1.0.0-beta.4

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

FastSharp

NuGet .NET Publish NuGet packages Stars

FastSharp is a lightweight metaframework for building APIs in C# and ASP.NET Core (Minimal APIs). Full CRUDs and custom endpoints, organized by domain modules, in a single line of code.


Why FastSharp?

In ASP.NET Core Minimal APIs, even a simple CRUD for one entity means writing the same boilerplate over and over. FastSharp eliminates that:

// This single line generates 6 REST endpoints backed by EF Core
AddCRUD<Product, int>("products");

No controllers. No repetition. Just modules organized by domain.


Installation

dotnet add package FastSharp.Modules
dotnet add package FastSharp.Models

FastSharp.Modules is the core. FastSharp.Models contains only the model interfaces — add it to projects that don't need the full core.


Quick Start

The minimum setup requires 4 files. This example uses an in-memory database so you can run it immediately.

1. Install the dependencies

dotnet add package FastSharp.Modules
dotnet add package FastSharp.Models
dotnet add package Microsoft.EntityFrameworkCore.InMemory

2. Your model

// Models/Product.cs
using FastSharp.Models;

public class Product : IModel<int>
{
    public int Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public decimal Price { get; set; }
}

3. Your DbContext

// Data/AppDbContext.cs
using Microsoft.EntityFrameworkCore;

public class AppDbContext : DbContext
{
    public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
    public DbSet<Product> Products => Set<Product>();
}

4. Your module

// Modules/Products/ProductsModule.cs
using FastSharp.Modules;

public class ProductsModule : Module<AppDbContext>
{
    public ProductsModule()
    {
        ConfigureModule("api/", module => module.WithTags("Products"));
        AddCRUD<Product, int>("products");
    }
}

5. Program.cs

using FastSharp.Modules;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDbContext<AppDbContext>(opt =>
    opt.UseInMemoryDatabase("fastsharp-demo"));

builder.Services.AddFastSharpEndpoints();
builder.Services.AddOpenApi();

var app = builder.Build();
app.MapFastSharpEndpoints();
app.MapOpenApi();
app.Run();

Run the project and open /openapi/v1.json — you'll see all 6 endpoints ready to use.


What does AddCRUD generate?

Method Route Description
GET /api/products/paged Paginated list
GET /api/products Full list
GET /api/products/{id} Get by ID
POST /api/products Create
PUT /api/products/{id} Update
DELETE /api/products/{id} Delete

Configuration

Disable specific endpoints

AddCRUD<Product, int>("products", crud =>
{
    crud.DisableEndpoint(GenericEndpoint.GetList);
});

Use DTOs

AddCRUD<Product, int>("products", crud =>
{
    crud.Update<ProductDto>();
    // Or apply DTOs to all endpoints:
    // crud.ConfigureAll<ProductDto>();
});

Add metadata for OpenAPI

AddCRUD<Product, int>("products", crud =>
{
    crud.Get(endpoint =>
        endpoint.WithDescription("Get a product by its unique identifier"));
});

Add custom endpoints to the same module

public ProductsModule()
{
    ConfigureModule("api/", module => module.WithTags("Products"));
    AddCRUD<Product, int>("products");

    // Custom endpoints inherit the module's group configuration
    Include<CheckProductStock>();
}

Architecture

FastSharp is built on Modular Slices — group your logic by domain, not by technical layers.

YourProject/
└── Modules/
    ├── Products/
    │   ├── ProductsModule.cs
    │   ├── CheckProductStock.cs
    │   └── ProductDto.cs
    └── Orders/
        ├── OrdersModule.cs
        └── OrderDto.cs

Each module is a self-contained unit: its routes, its DTOs, its custom endpoints. FastSharp auto-discovers all modules in your assembly — no manual registration needed.


Requirements

  • .NET 10 or higher
  • Entity Framework Core
  • A registered DbContext in the dependency container
  • Models implementing IModel<TId>
  • Modules inheriting from Module<TDbContext>

Docs


License

MIT

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
1.0.0-beta.16 79 7/28/2026
1.0.0-beta.12 124 6/11/2026
1.0.0-beta.11 72 5/29/2026
1.0.0-beta.8 73 4/14/2026
1.0.0-beta.7 74 4/1/2026
1.0.0-beta.6 69 3/31/2026
1.0.0-beta.5 66 3/31/2026
1.0.0-beta.4 68 3/23/2026
1.0.0-beta.3 69 3/21/2026
1.0.0-beta.2 79 2/21/2026
1.0.0-alpha.4 82 2/12/2026
1.0.0-alpha.1 81 2/11/2026