Skip to content

Why axum-autodoc ​

axum-autodoc brings the developer experience of @elysiajs/openapi to axum: you write ordinary handlers and the documentation is inferred from what they already say.

The signature is the source of truth ​

An axum handler signature already tells you almost everything a client needs to know:

  • which path, query and header parameters it reads,
  • what body it accepts and in which media type,
  • whether it needs a token,
  • what it returns on success and which errors it can produce.

Most OpenAPI libraries ask you to say all of that a second time in an annotation. Two copies drift. axum-autodoc reads the first copy instead, so there is nothing to keep in sync.

It does not compile if it cannot be documented

If a handler uses an extractor or return type that cannot be documented, the route does not compile. The docs cannot silently fall behind the code.

Compared ​

axum-autodocutoipaaide
No per-handler annotationyesnoyes
Validation from the same schemayesnono
Every status that can happenyesnono
Typed TypeScript clientyesnono

What you get ​

RouteServes
/openapiScalar API reference (or Swagger UI)
/openapi/jsonOpenAPI 3.2 document
/client.tsTyped TypeScript client (feature ts)

The paths, the Scalar default and the builder options follow @elysiajs/openapi, so if you have used Elysia the configuration will feel familiar.

Status ​

axum-autodoc is at 0.2. The API may still change before 1.0. The minimum supported Rust version is 1.88.

Ready? Head to the quick start.

Released under the MIT or Apache-2.0 license.