Minimal API Endpoint Scaffolder
Describe an entity and its fields to generate ASP.NET Core Minimal API endpoint code — MapGroup, CRUD routes, DTOs, and a matching EF Core entity/DbSet snippet.
How to use this tool
- Enter an entity name (e.g.
Product) and, optionally, a route prefix. - Add each field as a name/type pair —
string,int,decimal,bool,DateTime,Guid, and similar are all recognized as-is. - Check which CRUD endpoints you want, and choose whether to use
TypedResultsand separate DTO records. - Click Generate, then copy the endpoints code into your
Program.csand the entity/DbSet snippet into your model andDbContext.
What this tool generates
ASP.NET Core Minimal API endpoint code using MapGroup and route-group MapGet/MapPost/MapPut/MapDelete calls, an AppDbContext-shaped EF Core dependency injected directly into each handler, and a matching entity class with a DbSet<T> line to add to your context. It's template generation from the fields and options you provide — nothing is sent to an external API, and no Roslyn/compiler dependency is involved in producing it.
Worked example
Entity Product with fields Name:string and Price:decimal, all five CRUD endpoints, TypedResults on, DTO records on, generates (list + get-by-id shown):
var products = app.MapGroup("/api/products").WithTags("Products");
products.MapGet("/", async (AppDbContext db) =>
TypedResults.Ok(await db.Products.ToListAsync()));
products.MapGet("/{id:int}", async Task<Results<Ok<Product>, NotFound>> (int id, AppDbContext db) =>
{
var entity = await db.Products.FindAsync(id);
return entity is not null ? TypedResults.Ok(entity) : TypedResults.NotFound();
});
TypedResults vs plain Results
TypedResults (the toggle's "on" state) uses the Results<TResult1, TResult2> union return type from Microsoft.AspNetCore.Http.HttpResults, with an explicit lambda return type annotation (async Task<Results<Ok<Product>, NotFound>> (...) => ...). This is fully statically typed — the compiler checks every possible response shape, and it's what OpenAPI/Swagger generation reads to document the endpoint's real response types. Plain Results (the toggle's "off" state) uses Results.Ok(...)/Results.NotFound() returning the untyped IResult interface — less ceremony, but OpenAPI metadata and the exact response shape aren't visible from the method signature alone.
What this tool can't do
It doesn't validate that your field types are real .NET types, doesn't generate EF Core migrations, and doesn't wire up dependency injection for AppDbContext itself — it assumes you already have an EF Core DbContext registered and named AppDbContext (rename it in the generated code if yours is named differently). The validation stubs on Create/Update are intentionally minimal — a real project should layer on FluentValidation, data annotations, or a validation library rather than relying on the generated string.IsNullOrWhiteSpace checks alone.
Fields
Endpoints to generate
Enter an entity name and fields, then click Generate.