32 breaking releases

new 0.44.0 Apr 23, 2024
0.42.0 Mar 18, 2024
0.35.2 Dec 21, 2023
0.34.1 Nov 29, 2023
0.13.0 Mar 27, 2023

#1 in #shuttle-service

Download history 2417/week @ 2024-01-05 1858/week @ 2024-01-12 1626/week @ 2024-01-19 1677/week @ 2024-01-26 1295/week @ 2024-02-02 1770/week @ 2024-02-09 1681/week @ 2024-02-16 1813/week @ 2024-02-23 2388/week @ 2024-03-01 3018/week @ 2024-03-08 2294/week @ 2024-03-15 2059/week @ 2024-03-22 2659/week @ 2024-03-29 2106/week @ 2024-04-05 2582/week @ 2024-04-12 2284/week @ 2024-04-19

9,912 downloads per month
Used in 21 crates

Apache-2.0

265KB
5.5K SLoC

Shuttle - Deploy Rust apps with a single Cargo subcommand

Shuttle is a Rust-native cloud development platform that lets you deploy your Rust apps for free.

📖 Check out our documentation to get started quickly: docs.shuttle.rs

🙋‍♂️ If you have any questions, join our Discord server.

Usage

Start by installing the cargo shuttle subcommand by running the following in a terminal:

cargo install cargo-shuttle

Now that Shuttle is installed, you can initialize a project with Axum boilerplate:

cargo shuttle init --template axum my-axum-app

By looking at the Cargo.toml file of the generated my-axum-app project you will see it has been made to be a binary crate with a few dependencies including shuttle-runtime and shuttle-axum.

axum = "0.7.3"
shuttle-axum = "0.44.0"
shuttle-runtime = "0.44.0"
tokio = "1.28.2"

A boilerplate code for your axum project can also be found in src/main.rs:

use axum::{routing::get, Router};

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

#[shuttle_runtime::main]
async fn main() -> shuttle_axum::ShuttleAxum {
    let router = Router::new().route("/", get(hello_world));

    Ok(router.into())
}

Check out our docs to see all the frameworks we support, or our examples if you prefer that format.

Running locally

To test your app locally before deploying, use:

cargo shuttle run

You should see your app build and start on the default port 8000. You can test this using;

curl http://localhost:8000/
# Hello, world!

Deploying

Before you can deploy, you have to create a project. This will start a deployer container for your project under the hood, ensuring isolation from other users' projects. PS. you don't have to do this now if you did in in the cargo shuttle init flow.

cargo shuttle project start

Then, deploy the service with:

cargo shuttle deploy

Your service will immediately be available at https://{project_name}.shuttleapp.rs/. For example:

curl https://my-axum-app.shuttleapp.rs/
# Hello, world!

Dependencies

~13–27MB
~373K SLoC