Skip to content
المشاريع

حول

خادم ويب خفيف قابل للتضمين، مكتوب بالكامل بلغة C# ولا يعتمد إلا على عدد قليل من مكتبات الجهات الخارجية.

الأنظمة والبنية التحتية

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
+٣
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

GenHTTP Webserver

GenHTTP is a lightweight, modular web server written in pure C# with a strong focus on developer experience. The main purpose of this project is to quickly create web services written in .NET 10 / 11, allowing developers to concentrate on the functionality rather than on messing around with configuration files or complex concepts.

Try it - Online View - Documentation nuget Package HTTP Arena Coverage Discord

Getting Started

To host a GenHTTP server instance in an existing or new .NET project, add a nuget reference to GenHTTP.Full to your project and spin off a new host:

using GenHTTP.Engine.Internal;

using GenHTTP.Modules.ApiBrowsing;
using GenHTTP.Modules.Functional;
using GenHTTP.Modules.Layouting;
using GenHTTP.Modules.OpenApi;
using GenHTTP.Modules.Practices;

// use a handler of your choice (see the samples below)
var api = Inline.Create()
                .Get((int a, int b) => a + b);

var app = Layout.Create()
                .Add(api)
                .AddOpenApi()
                .AddScalar();

var host = await Host.Create()
                     .Handler(app)
                     .Defaults()
                     .StartAsync(); // or .RunAsync() to block until the (console) application is shut down

Running this snippet will provide the following endpoints:

Endpoint Description
http://localhost:8080/?a=1&b=2 Serves the API, answering requests by calculating the sum of two query arguments.
http://localhost:8080/openapi.json Serves the automatically generated Open API specification of the API.
http://localhost:8080/scalar/ Servers a graphical viewer of the API, using Scalar.

Samples

The samples on the website show the frameworks, handlers and concerns of GenHTTP as complete programs, and let you send requests to them as they run live. See the documentation for all available capabilities.

Agentic Coding

GenHTTP’s modules are decoupled and wired together explicitly, with no hidden magic, so every part of an application can be understood by reading its code. This makes GenHTTP a strong fit for agentic coding in C#, where AI agents can reliably understand, change and extend projects without unexpected side effects. GenHTTP Lambda uses those properties to build an agentic coding platform on top of GenHTTP.

Engines

GenHTTP runs on different runtime implementations that can simply be switched by changing a single nuget package reference and a using statement. Engines are tested to be compatible with all modules, so you can switch the runtime without any further adjustments.

Engine Protocols Performance Use Cases
Internal 1.1 HTTP Arena Embedding; web applications behind reverse proxy
Kestrel 1.1 2 3 HTTP Arena Web applications on the edge
ioxide 1.1 2 3 HTTP Arena High performance web applications on Linux via io_uring

Support

If you encounter issues implementing your application, feel free to join our Discord community to get help. For commercial products and projects, GenHTTP provides additional support options on request.

Building the Server

To build the server from source, clone this repository and run the playground project launcher for .NET 11:

git clone https://github.com/Kaliumhexacyanoferrat/GenHTTP.git
cd ./GenHTTP/Playground
dotnet run

This will build the playground project launcher with all the server dependencies and launch the server process on port 8080.

History

The web server was originally developed in 2008 to run on a netbook with an Intel Atom processor. Both IIS and Apache failed to render dynamic pages on such a slow CPU back then. The original project description can still be found on archive.org. In 2019, the source code has been moved to GitHub with the goal to rework the project to be able to run dockerized web applications written in C#. In 2024 the focus has shifted towards API development, dropping support for generating graphical web applications. In 2026, the API and internal engine have been rewritten to be allocation-free, greatly improving performance in result.

Thanks

Supported by

JetBrains logo.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…