Mugi 0.1.3
dotnet add package Mugi --version 0.1.3
NuGet\Install-Package Mugi -Version 0.1.3
<PackageReference Include="Mugi" Version="0.1.3" />
<PackageVersion Include="Mugi" Version="0.1.3" />
<PackageReference Include="Mugi" />
paket add Mugi --version 0.1.3
#r "nuget: Mugi, 0.1.3"
#:package Mugi@0.1.3
#addin nuget:?package=Mugi&version=0.1.3
#tool nuget:?package=Mugi&version=0.1.3
Mugi
Mugi is a fast, simple web application framework for .NET. Write handlers as lambdas, route requests, run middleware, bind and validate typed input, and read the request and write the response through one context object. It runs on Kestrel without WebApplication, the Generic Host, or a dependency injection container.
Mugi is built for NativeAOT. At runtime it uses no reflection, no assembly scanning, and no runtime code generation, so a published app starts in a few milliseconds and ships as a single small binary. Routing, JSON, and typed input binders are prepared at compile time by the Mugi.Generators package; referencing that package is enough.
Install
<ItemGroup>
<PackageReference Include="Mugi" Version="0.1.3" />
<PackageReference Include="Mugi.Generators" Version="0.1.3" />
</ItemGroup>
Add Mugi.Schema when the app uses typed input and validation. The packages target net9.0; building needs the .NET 9 SDK or newer.
Quick start
using Mugi;
var app = new App();
app.Get("/", static c => c.Text("Hello"));
app.Get("/users/:id", static c => c.Json(new User(c.Param("id"), "Ada")));
app.Run();
public sealed record User(string Id, string Name);
GET /users/42 returns {"id":"42","name":"Ada"}. The default port is 3000; the PORT environment variable changes the listener without touching the code.
What the package covers
- Routing with
:nameand*namepatterns, correct 404, 405,HEAD, andOPTIONShandling. - One context object for the request and the response:
c.Param,c.Query,c.Req.Header,c.Req.Json<T>,c.Text,c.Json,c.Html,c.Stream, and more. - Onion-order middleware with
app.Use, plus built-in factories: request logging, request IDs, secure headers, CORS, CSRF, Basic and Bearer auth, compression, ETag, and request timeouts. - Cookies with optional HMAC signing, form and multipart parsing, server-sent events, and WebSockets.
- Static file serving with conditional requests, byte ranges, and precompressed siblings.
- An in-process test client:
app.Request("GET", "/users/42")runs the full pipeline without a server. - Typed contexts: derive from
Contextand useApp<TContext>to pass values from middleware to handlers without string keys or casts.
Full documentation, benchmarks, and samples are at github.com/hckaye/Mugi.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- Mugi.Json (>= 0.1.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Mugi:
| Package | Downloads |
|---|---|
|
Mugi.Jwt
Native AOT-compatible JWT signing, validation, and authentication middleware for Mugi. |
|
|
Mugi.Schema
Typed request binding and validation for Mugi. |
GitHub repositories
This package is not used by any popular GitHub repositories.