Shuttle - Deploy Rust apps with a single Cargo subcommand
Hello, and welcome to the shuttle API documentation!
Shuttle is an open-source app platform that uses traits and annotations to configure your backend deployments.
Usage
Depend on shuttle-service in Cargo.toml:
= { = "0.2", = ["web-rocket"] }
and make sure your crate has a cdylib output target:
[]
= ["cdylib"]
See the [shuttle_service::main][main] macro for more information on supported services - like Axum. Here's a simple example using rocket to get you started:
extern crate rocket;
use ;
async
Complete examples can be found in the repository.
Deploying
You can deploy your service with the cargo shuttle subcommand. To install run:
in a terminal. Once installed, run:
this will open a browser window and prompt you to connect using your GitHub account.
Then, deploy the service with:
Your service will immediately be available at {crate_name}.shuttleapp.rs. For example:
Using sqlx
Here is a quick example to deploy a service which uses a postgres database and sqlx:
Depend on shuttle-service in Cargo.toml:
= { = "0.2", = ["web-rocket", "sqlx-postgres"] }
extern crate rocket;
use ;
use PgPool;
;
async
To learn more about shuttle managed services, see [shuttle_service::main][main#getting-shuttle-managed-services].
Configuration
The cargo shuttle command can be customised by creating a Shuttle.toml in the same location as your Cargo.toml.
Getting API keys
After you've installed the cargo-shuttle command, run:
this will open a browser window and prompt you to connect using your GitHub account.
Change the name of your service
To have your service deployed with a different name, add a name entry in the Shuttle.toml:
= "hello-world"
If the name key is not specified, the service's name will be the same as the crate's name.
Alternatively, you can override the project name on the command-line, by passing the --name argument:
We're in alpha 🤗
Thanks for using shuttle! We're very happy to have you with us!
During our alpha period, API keys are completely free and you can deploy as many services as you want.
Just keep in mind that there may be some kinks that require us to take all deployments down once in a while. In certain circumstances we may also have to delete all the data associated with those deployments.
To stay updated with the release status of shuttle, join our Discord!
Join Discord
If you have any questions, join our Discord server. There's always someone on there that can help!
You can also open an issue or a discussion on GitHub.