A fast and simple HTTP server library for C

Build HTTP servers in C, the modern way

libchttpx is a compact HTTP/1.1 server library with routing, middleware, JSON helpers, uploads, TLS, compression, built-in metrics and graceful shutdown.

Open source · BSD 3-Clause · C/C++ friendly
example.c
#include <libchttpx.h>

static void health(chttpx_request_t* req,
                   chttpx_response_t* res)
{
    (void)req;
    *res = cHTTPX_ResMessage(
        cHTTPX_StatusOK, "healthy"
    );
}

int main(void)
{
    chttpx_app_t app;
    cHTTPX_AppInit(&app);

    chttpx_config_t config = cHTTPX_DefaultConfig();
    config.port = 8080;

    chttpx_serv_t* server =
        cHTTPX_AppServer(&app, "main", &config);

    chttpx_router_t router =
        cHTTPX_RoutePathPrefix(server, "");

    cHTTPX_Get(&router, "/health", health);
    return cHTTPX_AppRun(&app);
}
⚡

High performance

Small C runtime with direct control over server behavior.

◎

Easy to use

Routing, responses and helpers without repetitive HTTP plumbing.

◇

Flexible

Middleware, TLS, gzip compression, metrics, JSON, uploads and custom server limits.

▤

Documented

Module-by-module documentation and runnable examples.

⌘

Open source

Read the code, contribute, fork it and build on top of it.

— GitHub stars
— Forks
— Open issues
— Latest release

Why libchttpx?

Keep HTTP code small and readable

The library is designed so handlers contain application logic instead of repetitive request parsing, response building and server boilerplate.

Read the documentation →
  • Embedded and internal HTTP services
  • Microservices and backend APIs
  • Route groups and middleware pipelines
  • JSON validation and response builders
  • Multipart forms and file uploads
  • Linux and Windows development

Support the project

Use it for free. Pay only when you need help.

libchttpx stays open source. Commercial help, integration work and sponsorship are separate ways to support continued development.

♥ Sponsor development

Interested in funding features or long-term maintenance?

Sponsor options

◌ Report an issue

Found a bug or have a feature request? Open it publicly on GitHub.

GitHub Issues ↗

▢ Professional support

Need help with integration, debugging, review or a custom feature?

Contact