All templates

Deploy Rust Axum on Rebasable

Rust web server with Axum 0.8 and Tokio, compiled in release mode.

Runtime: rust Free instance rustapi

How it works

Rebasable detects Rust from Cargo.toml, builds with cargo build --release using Cargo.lock, and runs the binary. The build cache is kept between deploys, so later builds only recompile what changed. The server binds 0.0.0.0:$PORT and shuts down cleanly on the stop signal.

Run it locally

cargo run   # http://localhost:3000

Use it as your own repository

Copy the rust-axum folder of the templates repository into a new repo (the files at the root, rebasable.yaml included) and push it. Then add a Deploy button to its README, or create it from Blueprints, New blueprint in the dashboard. From then on, every push deploys, and pull requests get preview environments.

Good to know

  • The first build compiles every dependency and takes a few minutes; cached rebuilds are much faster.
  • Postgres from Rust: add a databases: entry and read DATABASE_URL with sqlx or tokio-postgres.