Livery

One handler set. Every version of HTTP.

A web framework for Erlang/OTP. You write your routes, middleware and handlers once, and Livery serves them over HTTP/1.1, HTTP/2 and HTTP/3 at the same time. It follows the ideas of Rust's Axum, Tower and Hyper.

Get started → View on GitHub
{deps, [livery]}.
HTTP/1.1 HTTP/2 HTTP/3 · QUIC WebSocket WebTransport SSE MCP A2A

Three protocols on one host

One start_service/1 call starts HTTP/3 on UDP, HTTP/2 on TLS and HTTP/1.1 on TCP, all with the same router and middleware. An Alt-Svc header tells clients HTTP/3 is there, so they can switch to it.

%% one router, served over every protocol
Router = livery_router:compile([
    {<<"GET">>, <<"/">>, fun(_Req) ->
        livery_resp:text(200, <<"hello from livery">>)
    end},
    {<<"GET">>, <<"/users/:id">>, {users, show}}
]),

livery:start_service(#{
    http  => #{port => 80},
    https => #{port => 443, cert => Cert, key => Key, alpn => [h2, http1]},
    http3 => #{port => 443, cert => Cert, key => Key},
    router => Router,
    middleware => [{livery_request_id, undefined}, {livery_access_log, #{}}],
    alt_svc => advertise
}).

What comes in the package

What you would otherwise put together from a dozen libraries, in one place.

🛰️

One handler, three protocols

Write a handler once and it serves HTTP/1.1, HTTP/2 and HTTP/3. The protocols themselves live in separate libraries; Livery only connects them to your code.

🧩

Middleware as plain functions

A middleware is call(Req, Next, State): it gets the request and the rest of the pipeline, and returns a response. Add it to the whole service or to one route.

🌊

Streaming everywhere

Chunked responses, Server-Sent Events, NDJSON, WebSocket on every protocol, WebTransport on HTTP/2 and HTTP/3, and files with byte ranges.

📜

OpenAPI & validation

Generate an OpenAPI 3.2 document from your routes, serve Redoc or Swagger UI, and check request bodies against a subset of JSON Schema.

🤖

Ready for AI agents

Serve MCP (Model Context Protocol) tools and A2A (Agent-to-Agent) agents on your main listener, with the same auth and tracing. No second server.

🔭

Observability & auth

OpenTelemetry-style traces and metrics, logs tagged with the trace, and sign-in with OpenID Connect, passkeys, one-time codes, access tokens and signed sessions.

Built on Livery

Companion libraries built on Livery's client and HTTP/2 support, each in its own repository.

🛰️

livery_grpc

gRPC server and client on Livery's HTTP/2 stack: all four call types, deadlines, gRPC-Web, server reflection, and the health service.

🪣

livery_s3

S3-compatible object storage client on the Livery HTTP client: SigV4 signing, multipart uploads, and presigned URLs. AWS S3, Garage, MinIO, Ceph, Wasabi.

💳

livery_stripe

Stripe API client on the Livery HTTP client: customers, subscriptions, Checkout, the Billing Portal, and webhook verification.