axum-server

A hyper-based HTTP server designed to be used with the Rust axum web framework.

Library
Cargo
v0.8.0
261stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
54/100Fair
Development Activity44
Maintenance32
Community64
Maturity56
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture82
Code Quality84
Innovation74
Learning Curve80

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.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search