Skip to content

Rust · In Production

You finished the project-first playbook — you can write Rust, you’ve shipped a CLI, a key-value store, an async API, an AI tool, even three mini-blockchains. So here’s the question nobody on YouTube answers: what do people actually build with Rust, and how does it fit into a real production stack? Not “hello world with axum” — the whole thing: a frontend, a database, AI, a cache, containers, an orchestrator, dashboards, and the profiler run that makes it fast.

This is the advanced path. Instead of many small toys, you build one real application and take it all the way to production. That app is quill — a small blog that grows an AI writing assistant — and across seven parts you’ll wrap it in everything a real service needs:

Astro frontend ──HTTP / SSE──▶ quill · Rust backend (axum + Postgres)
┌───────────────┬───────────────┼────────────────┬───────────────┐
▼ ▼ ▼ ▼ ▼
Redis rate limit Claude API Postgres Prometheus
(cache / jobs) (per key) (AI drafting, (posts, users) + tracing
streaming)
└────────── Docker images ──▶ Kubernetes (probes · HPA) ──▶ profiled & tuned ┘

The thread on every page: once the code compiles, what does it take to make it run — safely, fast, and observably — for real users? That’s the gap between “I know Rust” and “I ship Rust,” and it’s the whole subject of this book.

Orientation

The build · quill, from cargo new to production

Section titled “The build · quill, from cargo new to production”

Part 1 · The Blog Core

The real app: a Cargo workspace, an axum server, Postgres via sqlx, migrations, a clean domain model, and a production-shaped error story.

Part 2 · The Frontend — Astro on Rust

Wire an Astro frontend to the Rust backend: the front/back contract, SSR vs SSG against a live API, an editor that posts real data, sessions, and Server-Sent Events (the pipe your AI stream will use).

Part 3 · AI Content Generation

The feature that makes quill worth building: call the Claude API from the server, stream a generated draft token-by-token into the editor, run generation as background jobs, and add guardrails, caching, and cost control.

Part 4 · Production Infra — Redis, Docker, Kubernetes

Redis for caching, rate-limiting, and a job queue; multi-stage Docker images that are tiny and non-root; then Kubernetes — manifests, config/secrets, health probes, rolling deploys, and autoscaling.

Part 5 · Observability

You can’t operate what you can’t see. Structured logging and spans with tracing, Prometheus metrics and the four golden signals, and distributed tracing across the whole request path.

Part 6 · Make It Fast — Optimization

Where Rust’s speed actually comes from, and how to claim it: measure first (criterion, flamegraphs, tokio-console), then tune async, pooling, allocations, and caching — with before/after numbers from a real load test.

Part 7 · Ship It & What’s Next

CI/CD with GitHub Actions, a production readiness checklist, the full deploy — then where to go next, including the bridge back toward your Solana/Anchor goal.