This section revolves around simple Axum examples you can get quickly started with by following these 3 steps:

  1. Initialize a new Axum project by running the cargo shuttle init --template axum command
  2. Copy pasting the contents of the example you want to deploy — make sure to check the tabs of the snippet(s) to ensure you are copying the right code/file
  3. Running the cargo shuttle deploy command
If you are looking for step-by-step guides, check out our Tutorials section.

You can clone the example below by running the following (you’ll need cargo-shuttle installed):

cargo shuttle init --template axum
use axum::{routing::get, Router};

async fn hello_world() -> &'static str {
    "Hello, world!"
}

#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {

    let router = Router::new().route("/", get(hello_world));

    Ok(router.into())
}

If you want to explore other frameworks, we have more examples with popular ones like Tower and Warp. You can find them right here.

Be sure to check out the examples repo for many more examples!