A practical guide to building production backend services in Rust — with Axum, Tokio, SQLx, and the rest of the modern async ecosystem.
This is a CloudStreet book. Technical, accurate, and genuinely amusing. The reader is a competent developer who knows Rust basics and is ready to build something real. No toy examples. No guessing which crate to use.
→ Read online at cloudstreet-dev.github.io/Backend-Rust
| Chapter | Topic |
|---|---|
| Introduction | Why Rust for the Backend? |
| Async Rust | Tokio and the Runtime Under Your Feet |
| HTTP Servers | Axum: Routing, Middleware, and State |
| Databases | SQLx: Async, Typed, and Honest |
| Authentication | JWTs, Sessions, and Not Screwing It Up |
| Error Handling | thiserror, anyhow, and When to Use Which |
| Configuration | Environments, dotenv, and Not Leaking Things |
| Testing | Unit, Integration, and the Awkward Middle |
| Observability | Tracing, Logging, and Knowing What Broke |
| Deployment | Docker, Binaries, and Why Your Image Can Be Tiny |
| Conclusion | Where to Go From Here |
| Concern | Crate | Version |
|---|---|---|
| Async runtime | tokio |
1.x |
| HTTP framework | axum |
0.7.x |
| Database | sqlx |
0.7.x |
| Middleware | tower / tower-http |
0.5.x |
| Tracing | tracing / tracing-subscriber |
0.1.x |
| Error handling | thiserror / anyhow |
1.x |
| Configuration | config + dotenvy |
0.14.x / 0.15.x |
| JWT | jsonwebtoken |
9.x |
Install Rust (1.75+):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stableInstall mdBook:
cargo install mdbook# Clone the repo
git clone https://github.com/cloudstreet-dev/Backend-Rust.git
cd Backend-Rust
# Serve locally with live reload
mdbook serve --open
# Build to ./book/
mdbook buildThe book will be available at http://localhost:3000.
Built with mdBook. Deployed to GitHub Pages on every push to main.
Code examples are written for the 2021 edition and target Rust 1.75+. All examples use the async/await syntax and are designed to compile against current stable crate versions.
CloudStreet — making the useful also readable.