Rocket From Zero
Learn Rust's most ergonomic web framework: attribute-route handlers and launch, dynamic paths, request guards and data, responders, managed state and fairings, a full REST API with error catchers, and testing and config. The framework that makes Rust web code read almost like Flask — powered by macros.
- What Rocket Is & Your First Server Rocket is Rust's ergonomic web framework: write an attribute over a function and you have a route. Install it, write a tiny server, run it, and meet the macros that wire everything together.
- Routing & Dynamic Paths How Rocket maps URLs to functions: method attributes, dynamic path segments with FromParam, multi-segment PathBuf, optional query params, and why a route must live in routes! to ever run.
- Request Guards & Data How a handler reads the request body with Json and Form, and how request guards turn auth into a type in your function signature — checked before the handler ever runs.
- Responders Your handler's return type IS the HTTP response. Learn Rocket's built-in responders — Json, Option for free 404s, Result, (Status, T) — and how to build your own.
- Managed State & Fairings Share dependencies across handlers with managed state and the &State<T> guard, then hook into the whole request/response lifecycle with fairings — Rocket's middleware.
- A REST API with Error Catchers Wire five attribute-routed handlers over managed state into a full CRUD books API, then add #[catch(404)] error catchers for a consistent JSON error shape across the whole service.
- Testing & Configuration Test your Rocket books API in-process with the local Client — no ports, no network — then configure it with Rocket.toml profiles and ROCKET_* env vars, and harden it for production.
- Where to Go Next You can build, test, and configure a real Rocket API. Now the honest map: Rocket vs axum/actix, a real database via rocket_db_pools/sqlx, the Tokio roots, and what to build.