Effortless REST API Development with C#
A configuration-free, embeddable alternative to ASP.NET Core for building REST APIs on .NET.
dotnet add package GenHTTP.Full
Open source under the MIT license, on NuGet for .NET 10 and later.
Service
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.Functional;
using GenHTTP.Modules.Practices;
// http://localhost:8080/users/42
var api = Inline.Create()
.Get("/users/:id", (int id) => new User(id, "Jane"));
await Host.Create()
.Handler(api)
.Defaults()
.RunAsync();
public record User(int Id, string Name);Open API
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.Functional;
using GenHTTP.Modules.OpenApi;
using GenHTTP.Modules.Practices;
// http://localhost:8080/openapi.json
var api = Inline.Create()
.Get("/users/:id", (int id) => new User(id, "Jane"))
.AddOpenApi();
await Host.Create()
.Handler(api)
.Defaults()
.RunAsync();
public record User(int Id, string Name);JWT
using GenHTTP.Engine.Internal;
using GenHTTP.Modules.Authentication;
using GenHTTP.Modules.Functional;
using GenHTTP.Modules.OpenApi;
using GenHTTP.Modules.Practices;
var auth = BearerAuthentication.Create()
.Issuer("https://sso.example.com/");
var api = Inline.Create()
.Get("/users/:id", (int id) => new User(id, "Jane"))
.AddOpenApi()
.Add(auth);
await Host.Create()
.Handler(api)
.Defaults()
.RunAsync();
public record User(int Id, string Name);More
31 modules on NuGet, among them
Real time
Security
Hosting
A web server you add like any other package
No configuration files, no hosting model to learn. GenHTTP is a library you reference, configure in code and run wherever your application runs.
Fast Development
GenHTTP is designed for rapid web service development in .NET, supporting IDEs like Visual Studio, VS Code or Rider.
100% Managed
Written in C# and provided as a .NET library package on NuGet, with just a few dependencies. Spin up a local server with a single line of code.
Simple & Powerful
Provides a simple, yet powerful, fully object-oriented module system. Supports widely used standards such as Open API, WebSockets, Server Sent Events, or JWT authentication.
Flexible Hosting
Embed the tiny engine into your existing dotnet application (e.g. Windows Forms, WPF, MAUI, WinUI, UWP, Uno, Avalonia or console) or host it via Docker. No configuration files or other magic.
Minimal Footprint
Originally intended to run on a netbook with an Intel Atom processor, the server code is optimized to be fast and minimalistic, with low CPU and memory requirements.
Open Source
All sources are available on GitHub under the MIT license. Contributions welcome.
The fastest web server for HTTP/1.1
According to HTTP Arena, stock GenHTTP is 1.5 times faster than ASP.NET Core Minimal API in a mixed challenge with different use cases and usage scenarios.
One application, three engines
Replace the HTTP engine without touching your application code - change the package and the Host namespace you import.
Pick the framework that fits your application
Every framework runs on the same server and the same modules, so you can mix them within one application.
- Webservices Provide REST based web services in C# that can be consumed by clients to retrieve a JSON, YAML, or XML serialized result.
- Functional Handlers Respond to HTTP requests in a functional manner with no boiler code.
- Controllers Lightweight framework to write web APIs using the controller pattern in C#.
- Websockets Create a simple websocket server in C# and dotnet
- Single Page Applications (SPA) Simple way to host applications written with JS frameworks such as Vue.js, Angular or React.
- Static Websites Simple way to host static websites with sitemap and robots.txt support
- Custom Frameworks Shows how to use the underlying capabilities of GenHTTP to spin of a custom framework.
Talk to us
Questions, ideas or a project of your own - the community and the team behind GenHTTP are glad to help.