Deploy your first app
Start with this small Axum application. You need Git, a current stable Rust toolchain with Cargo, and curl. Create a workspace and set its password first. Already have a service? Skip to Configure your app.
1. Create the project
Run these commands in a directory outside any existing Cargo workspace:
cargo new hello-leilani --bin --vcs git
cd hello-leilani
git branch -M main
Replace Cargo.toml with:
[package]
name = "hello-leilani"
version = "0.1.0"
edition = "2024"
[dependencies]
axum = "0.8"
tokio = { version = "1", features = ["macros", "rt-multi-thread", "net"] }
Replace src/main.rs with:
use axum::{Router, routing::get};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let app = Router::new().route("/", get(|| async { "Hello from Leilani\n" }));
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
println!("hello-leilani listening on 0.0.0.0:3000");
axum::serve(listener, app).await
}
2. Run it locally
Generate the lockfile, then build and run using those exact dependency versions:
cargo generate-lockfile
cargo run --locked
Wait for hello-leilani listening on 0.0.0.0:3000. In a second terminal, run:
curl --fail --show-error http://localhost:3000/
Expected response:
Hello from Leilani
Stop the local server with Ctrl+C. Run the remaining commands from the hello-leilani project directory.
3. Configure and push
Create leilani.json beside Cargo.toml. Replace WORKSPACE-ID with the ID shown on Deploy; keep hello-leilani as the package name:
{
"packages": {
"hello-leilani": { "args": [] }
},
"http": {
"binds": {
"WORKSPACE-ID.aloha.leilani.dev": 3000
}
}
}
Commit the source, configuration, and generated Cargo.lock. Replace WORKSPACE-ID in the remote URL too:
git add .gitignore Cargo.toml Cargo.lock src/main.rs leilani.json
git commit -m "Create hello-leilani"
git remote add leilani https://leilani.dev/git/WORKSPACE-ID
git push leilani main
Use your workspace ID as the Git username and the password you set in Profile. If Git asks for your author identity before committing, configure user.name and user.email, then retry the commit. Wait for the build to finish and check the package on Deploy.
4. Verify HTTPS and logs
Running on Deploy means the process started; Leilani has not checked its HTTP response. Make the first public request, replacing WORKSPACE-ID:
curl --fail --show-error "https://WORKSPACE-ID.aloha.leilani.dev/?quickstart=hello-leilani"
Expected response:
Hello from Leilani
Open the hello-leilani startup output in Logs. The query is:
{kind="PackageLog", package="hello-leilani"}
Then open the quickstart request in Logs to see the HTTP request recorded by Leilani’s proxy. Allow a few seconds for logs to arrive. The query-string marker identifies this curl request; no logging library is needed. Copy its request_id to find the matching response.
If the request fails, check Deploy for the package’s state, then Logs for startup output. Compare the actual listener address with http.binds: this example must listen on 0.0.0.0:3000 and route to port 3000.
5. Deploy a change
Change the greeting in src/main.rs to Hello again from Leilani, keeping the newline. Commit and push:
git add src/main.rs
git commit -m "Update the greeting"
git push leilani main
After the new deployment starts, repeat the public curl command. It should return Hello again from Leilani.