Write a production-ready Rust HTTP API

Home » Write a production-ready Rust HTTP API

Write a production-ready Rust HTTP API


In this workshop, YOU will write a rust HTTP API that you wouldn’t be too ashamed of running in production at your company.
Using a Test Driven Development approach, you will learn to call external APIs, write integration tests and observe your API with traces and logs.


This workshop consists of a series of interactive exercises (similar to [rustlings]) that will guide you through creating an HTTP API iteratively.
The API will:
– Receive a Star Wars character name in input.
– Call [swapi], a free Star Wars API, to check how tall the character is.
– Return a boolean in a JSON payload to indicate if the character is taller than Yoda or not.
Have you played with Rust before but aren’t comfortable writing Rust backend code yet?
Then this workshop is for you!


Your tasks will include:
– Call the swapi API to retrieve data asynchronously by using [reqwest].
– Build an HTTP API by using [axum].
– Handle errors by using [thiserror] and [anyhow].
– Use [tracing] for logs and traces. You will visualize traces by running [jaeger] locally.
– Write tests by mocking external APIs with [wiremock].
After these tasks, you can choose what to implement next. Some suggestions from me:
– Use an in-memory cache of responses from `swapi`.
– Write a Dockerfile.
– Set a CI pipeline.


After this workshop you will know:
– How to build a simple HTTP API in Rust.
– How to use some key libraries of the Rust backend ecosystem.
– Where to look if you want to go deeper into the topics covered by the workshop.


Bring your laptop, because you’ll get your hands dirty!
Be sure to have the following software installed:
– Ensure you have the latest stable rust toolchain by running rustup update.
– (Optional) Your favorite editor configured for working with rust. If you don’t have one, I suggest VSCode with the rust-analyzer plugin.

Marco Ieni

Backend Engineer

I’m a computer engineer interested in the tech stack from microcontrollers to cloud microservices.
I’m simplifying maintaining Rust projects by building release-plz.

Expert on: Rust

Share on

Follow us on