Back to technologies

Axum (Rust)

Axum is a framework for building web services in Rust. It organizes routes and helps turn request data into values the program can use.

What you can build or improve

An API for incoming events

Validate each request’s format before handing the data to the process that records it.

Service within a Rust system

Add web routes that reuse types and rules the team already maintains in Rust.

When we’d choose it

We’d evaluate it for an API or integration service when Rust already makes sense for the performance requirements or the code your team maintains.

Why use it

Axum can turn request contents into the type the program expects and reject input that doesn’t match its structure. We can also reuse steps such as request logging across routes.

What to consider

Axum doesn’t define business rules or how to store data. The team needs Rust experience and should measure the whole service, including its database queries, before attributing gains to the framework.

Illustrative example

Receiving inventory events

A service receives batches of stock movements from several stores, rejects events with the wrong format, and sends valid ones for processing.

Official documentation

Tools and how they fit together

Axum helps organize how HTTP routes, application rules, and external services work together.

Routes and input data

Routes and input data

Define the format a route expects and convert input into a Rust type before applying business rules.

  • Axum
  • Serde
Runtime and diagnostics

Runtime and diagnostics

Tokio runs asynchronous work. Tower HTTP and tracing help log requests and follow a failure to the operation that caused it.

  • Tokio
  • Tower HTTP
  • tracing
Storing events

Storing events

Save valid events and define a key that identifies duplicates before the same movement is recorded twice.

  • SQLx
  • PostgreSQL

Questions before you decide

What can Axum validate on its own?

It can check the structure a route expects. Rules such as blocking an unauthorized inventory movement belong in the app.

Can we add an Axum service to an app written in another language?

Yes. It can expose an HTTP API to the existing app. Agree on data formats, error responses, and how each part is deployed.

Does Axum make every API faster?

Not necessarily. If the database or a provider causes the wait, changing the HTTP framework may do little. Measure the full request first.

What technology fits your project?

Tell us your idea