axum-rest-api-best-practices

Installation
SKILL.md

Axum REST API best practices

Use when building or reviewing Axum HTTP servers, handlers, extractors, and shared app state.

Structure

  • Organize routes by feature, not in one large file.
  • Keep handlers thin; move business logic into services or domain modules.

Request handling

  • Use typed extractors for path, query, State, and JSON bodies.
  • Validate request payloads before processing.

Responses and errors

  • Return correct HTTP status codes and structured JSON errors.
  • Use Result in handlers for clear error propagation.
  • Maintain a consistent error type that maps cleanly to API responses.
Installs
1
First Seen
Apr 12, 2026
axum-rest-api-best-practices — alexandretrotel/skills