axum-server
A hyper-based HTTP server designed to be used with the Rust axum web framework.
Repository Health
Technical Analysis
axum-server is a hyper server implementation built to run axum applications. Where axum defines your routes and handlers, axum-server provides the surrounding server: it binds an address, drives connections through hyper, and serves your tower make-service with HTTP/1 and HTTP/2 support.
Its headline capability is TLS. Through optional features it offers HTTPS via either rustls or OpenSSL, with helpers for loading certificates and rotating them at runtime, plus graceful shutdown coordinated through a Handle. The crate is written in 100% safe Rust (#![forbid(unsafe_code)]) and aims for very good compatibility across axum releases.
What You Get
- A simple bind()/serve() entry point that runs any axum or tower make-service
- HTTP/1 and HTTP/2 support powered by hyper
- HTTPS through rustls or OpenSSL as optional Cargo features
- Runtime certificate reloading for rotating TLS certs without downtime
- Graceful shutdown coordinated through a Handle
Common Use Cases
- Serving an axum web application over plain HTTP
- Terminating TLS directly in a Rust service with rustls or OpenSSL
- Rotating HTTPS certificates at runtime without restarting the server
- Coordinating graceful shutdown of a running server on a signal
Under The Hood
Architecture — The crate is organized around a Server type (src/server.rs) built from an Acceptor abstraction (src/accept.rs) and a Handle (src/handle.rs) for lifecycle control. bind() and bind_rustls()/bind_openssl() construct a server, serve() consumes a tower make-service and drives each accepted connection through hyper-util’s auto server. TLS lives in isolated modules (src/tls_rustls, src/tls_openssl) each pairing a mod.rs acceptor with a future.rs handshake, and notify_once.rs implements the one-shot signalling behind graceful shutdown.
Tech Stack — Pure Rust (MSRV 1.82) on hyper 1.4, hyper-util, tokio, http/http-body, and tower-service, with rustls 0.23 or openssl gated behind optional features. arc-swap backs hot-swappable rustls configs for runtime certificate reloading.
Code Quality — The crate declares #![forbid(unsafe_code)], guaranteeing 100% safe Rust, ships an examples directory covering plain HTTP, rustls, OpenSSL, and graceful shutdown, and maintains a CHANGELOG plus a minimal-versions check for dependency-floor correctness. Recent commit activity is modest, but the surface is small and stable.
API Design — The public API is intentionally tiny and ergonomic: axum_server::bind(addr).serve(app.into_make_service()).await mirrors the axum quickstart, and switching to HTTPS is a matter of calling bind_rustls with a RustlsConfig. Feature flags keep the default build lean while making TLS opt-in, and the Handle gives explicit, discoverable control over shutdown.
Used by 2 apps in this directory
Arroyo
Data Engineering · Analytics
A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.
Svix
Developer Tools · Automation
Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.