# Rust Axum API

An Axum todo API exposes health, runtime, list, and create routes from a compact Rust project. Tokay builds the source and serves it at a live URL as one Web Service.

Use it to see a Tokio and Axum service deployed from the same Cargo files you work with locally. Tokay takes responsibility for the release build and running process.

## Facts

- Runtime: Rust
- Framework: Axum
- Service types: Web Service
- Resources: None
- Required secrets: None

## What it does

Open the root route and the API identifies itself as the Rust service.

Request `/todos` for the three sample tasks. Post a title to add another item. A blank title receives a validation error and leaves the list unchanged.

The `/health` route gives monitors a small JSON response.

## Deploy it

Bring this folder to Tokay any way you like. Paste or upload it in the dashboard, push it with git, or hand it to your AI agent along with [our agent instructions](https://app.tokay.io/llms.txt). Tokay figures out the rest.

Working in Claude, ChatGPT, VS Code, or another MCP client? Connect the [Tokay MCP server](https://tokay.io/docs/platform-mcp) and ask your agent to deploy this example. It signs in through your browser, so there is no token to paste.

New to Tokay? The [getting started guide](https://tokay.io/getting-started) walks you through your first deploy.

## Try it

Send one write to your deployed API, then read the collection back.

```sh
export APP_URL="https://your-app.tokay.app"
curl -X POST "$APP_URL/todos" \
  -H 'Content-Type: application/json' \
  -d '{"title":"ship the next thing"}'
curl "$APP_URL/todos"
```

The list now contains your title. A later deployment starts from the samples again, which makes the boundary between process memory and durable storage easy to see.

## How it works

You only bring the Cargo project. Tokay compiles the release, supplies `PORT`, and starts the Axum listener while your Tokio and Serde code remains unchanged.

## Secrets

The service needs no secrets. All four routes are available without an outside account.

## Grow from here

Browse the [Tokay examples catalog](/examples) when you want saved data or a Background Worker.

## Source files

- [Cargo.toml](https://tokay.io/examples/src/rust-axum-api/Cargo.toml)
- [src/main.rs](https://tokay.io/examples/src/rust-axum-api/src/main.rs)

## Download and source

- [Download the complete project](https://tokay.io/examples/downloads/rust-axum-api.zip)
- Last updated: 2026-07-31
- Example revision: `52c7b7f`
- [View this revision on GitHub](https://github.com/tokayio/tokay-examples/tree/52c7b7ffd52e157375b08f1f11ff4fbe6c498642/rust-axum-api)
- [Deploy a Rust app](https://tokay.io/use-cases/deploy-rust-axum)
