Skip to content

cloudstreet-dev/Backend-Rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Rust

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 the Book

→ Read online at cloudstreet-dev.github.io/Backend-Rust


Table of Contents

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

The Stack

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

Building Locally

Prerequisites

Install Rust (1.75+):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default stable

Install mdBook:

cargo install mdbook

Build and Serve

# 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 build

The book will be available at http://localhost:3000.


About

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.

Releases

No releases published

Packages

 
 
 

Contributors