Skip to content
tako
Esc
↑↓navigate↵open⌘Jpreview
On this page

Rust and Axum

Serve an Axum application with Tako's Rust SDK, configure bootstrap and authenticated status handling, and package it for container deployment.

The Rust SDK crate is tako. Its axum feature integrates the router with Tako’s listener, readiness signal, and authenticated internal status endpoint.

Connect the router

[dependencies]
axum = "0.8"
tokio = { version = "1", features = ["full"] }
tako = { version = "0.2.1", features = ["axum"] }
use axum::{routing::get, Router};

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let app = Router::new().route("/", get(|| async { "Hello from Tako" }));
    tako::axum::serve(app).await
}

Keep existing routes and middleware on the router. The SDK binds from Tako’s HOST and PORT and reads bootstrap from fd 3 or container TAKO_BOOTSTRAP_DATA. Read private values with tako::secret("NAME"); see Secrets.

For custom Axum server loops, wrap the router with tako::axum::router and use the SDK listener. std_listener and listener alone report readiness but do not install HTTP status handling. See the Rust SDK skill for those APIs and Presence / Stores for native backend registries.

Package and verify

Run cargo check and cargo test. Package the binary with the Rust Dockerfile and configure a Docker release. The SDK handles 0.0.0.0:3000 inside the container.

There is no runtime = "rust" value or built-in Rust preset. Native binary deployments use explicit build/start commands; do not select an unrelated runtime to make detection succeed. Container deployment supplies a consistent build environment for the guide’s example.

After deployment, request the public route and inspect finite logs. Check protected Presence/Store routes when used. Upstream: Axum.

Last updated on

Was this page helpful?