Reference

Quickstart

Shuttle has a native integration for Axum by default with the shuttle-axum crate.

See the following code comparison below:

How does it work?

The Shuttle runtime exposes a trait, shuttle_runtime::Service, that services are required to implement before being able to run on Shuttle.

The shuttle-axum crate exposes an aliased Result type (shuttle_axum::ShuttleAxum) which simply wraps your router and implements From<axum::Router> which allows use of .into() on your Router. This integration includes serving the router itself.

If you want more custom behavior that is not supported by the native Shuttle integration, you can create a struct with your own custom implementation of shuttle_runtime::Service.