Ecosystem: Crates & Web Frameworks

Axum, Actix, reqwest, serde, and when to reach for Rust vs other languages.

serde serializes Rust structs to JSON; reqwest is the HTTP client; Axum is a popular async web framework on Tokio.

Core concepts

  1. serde: #[derive(Serialize, Deserialize)] for JSON APIs. — Serde
  2. Axum: Router + extractors + Tower middleware ecosystem. — Axum docs
  3. reqwest: Async HTTP — pair with tokio for scraping or proxy services. — reqwest docs
  4. WASM: wasm-bindgen for browser or edge modules. — wasm-bindgen guide
  5. When Rust wins: Predictable latency, low memory, safe concurrency — when team can pay compile-time cost. — The Rust Book: Introduction
rust
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
struct Health {
    ok: bool,
}

Concept videos

YouTube lessons for these topics. On a large screen they open in the reading panel next to the roadmap, same as the article links on each core concept.

Explanation

Rust’s ecosystem favors small, composable crates wired with traits and async runtimes — not one giant framework for everything.

serde

serde translates Rust structs to JSON, TOML, MessagePack, etc. Derive macros generate serialization code at compile time — fast and type-checked at build time when combined with schema tests.

Axum

Axum builds on Tokio and Tower — handlers are async functions with extractors for paths, JSON bodies, and state. Middleware shares the Tower ecosystem with other Rust HTTP stacks.

reqwest

reqwest is the ergonomic HTTP client for async Rust. Pair with timeouts, retries at the application layer, and structured error types from Result.

WASM

Compile Rust to WebAssembly for browser modules or edge workers — same language for backend and hot paths in the frontend, with sandboxed deployment.

When Rust wins

Choose Rust when latency variance, memory footprint, or safety under concurrency matter more than fastest time-to-first-demo. Pay compile times and learning curve as investment in runtime stability.

What Is It?

serde serializes/deserializes Rust types.

reqwest is the async HTTP client; Axum builds on hyper for web APIs.

Crates.io ecosystem covers CLI (clap), error (anyhow), and tracing.

Why Should I Care?

Most Rust jobs involve glue HTTP services, CLIs, or WASM modules — these crates are the default stack.

Choosing Rust vs Go/Python is a tradeoff interviewers expect you to articulate.

Real World Analogy

serde is a universal translator at the airport — your Rust struct speaks JSON, TOML, or MessagePack depending on which badge you clip on.

Visual Mental Model

text
Axum handler
     |
  serde JSON <-> struct
  reqwest HTTP client

Beginner Explanation

Learn serde + reqwest + one web framework (Axum popular). Reach for Rust when perf, safety, or WASM matter.

Smallest Possible Example

rust
use serde::Serialize;

#[derive(Serialize)]
struct User { name: String }

Common Mistakes

❌ Hand-rolling JSON with format! macros.

serde prevents escaping and schema bugs.

❌ Pulling in heavy frameworks for a tiny CLI.

Match crate weight to problem — Rust wins on focused binaries.

❌ Ignoring TLS feature flags on reqwest.

HTTPS needs rustls or native-tls features enabled explicitly.

Real Project Example

1Password ships Rust components; Figma uses Rust for perf-critical rendering helpers.

Cloudflare Workers support Rust WASM modules at the edge.

Build This Mini Project

Build an Axum route returning JSON of a struct, fetch it with reqwest in a small client binary in the same workspace.

Interview Question

When pick Rust over Python/Go?

When you need predictable memory use, fine-grained control, WASM targets, or eliminating data races at compile time — and team can pay the learning curve.

Key Takeaways

  • serde + reqwest + Axum is a common trio.
  • Crates.io + docs.rs for discovery.
  • Match Rust to perf/safety wins.
  • Feature flags control TLS and codecs.

Resources

The 60-second story

The workshop can now build a small machine. The ecosystem is the suppliers you trust enough to bolt on. Serde is the supplier who packs and unpacks crates for the road. You derive Serialize and Deserialize and a JSON API stops being a weekend of handwritten parsers. The derive macro is a stamp: “this struct knows how to become text and come back.”

Axum is a front counter for HTTP. A router sends each path to a handler. Extractors pull the JSON, the path id, or the headers into typed values so your handler is not digging through a string bag. Tower is the line of middleware in front of the counter: logging, timeouts, limits. You stack them instead of pasting the same five lines into every handler.

reqwest is the phone you use when your service has to call someone else. Pair it with Tokio, because the phone call is waiting, and waiting is what the async crew is for. Use it for a client, a proxy, a webhook. Do not invent HTTP on a socket unless that is the actual product.

WASM, through wasm-bindgen, is shipping a small machine that runs in a browser or on an edge worker, near the metal compared with a giant JavaScript bundle. You pay the compile. You get a module with a clear edge.

Rust wins the bid when the machine must be predictable: latency, memory, many connections, and you can afford the compiler’s lecture. It loses the bid when the team needed a form online by Thursday and nobody has held the cash-box rules yet. Python and TypeScript are allowed to win Thursdays.

Map the suppliers.

  • Serde packs and unpacks data.
  • Axum is the HTTP counter.
  • Extractors are typed hands taking the request apart.
  • Tower middleware is the line in front of the counter.
  • reqwest is the outbound phone.
  • wasm-bindgen is the crate you ship into a browser.
  • The compile-time lecture is the price of the predictable machine.
rust
#[derive(serde::Serialize)]
struct Ping {
    ok: bool,
}

That struct can leave the building as JSON without a hand-written writer. The rest of the stack is the same idea: types at the edges, tools that honor them.

The ecosystem looks like this because Rust’s promise is wasted if every HTTP service rewrites parsing. Frameworks here are thin where they can be. They do not hide the ownership rules. If a handler holds a request body and a spawned task incorrectly, the compiler still speaks up.

Mental model: suppliers at the edges, your rules in the middle. Serde at the door, Axum at the counter, Tokio on the phones. You still own the cash box.

You can explain the page by naming one job per crate and saying Rust is the right workshop when predictability is worth the lecture.

Threads in the same domain as this chapter — go deeper on iHateReading without leaving the roadmap.

Web scraping cover

Web scraping

Fetch and parse web data — the baseline skill behind browser-facing agents.

AI agent system that researches 100 blogs a day cover

AI agent system that researches 100 blogs a day

RSS, Reddit, YouTube transcripts, and URL hashing for a research pipeline.