Web APIs with Rust and Actix-web
Class Duration
21 hours of live training delivered over 3-5 days to accommodate your scheduling needs.
Student Prerequisites
- Working Rust experience equivalent to Rust Essentials
- Familiarity with HTTP and REST is helpful but not required
- Comfort with PostgreSQL or another SQL database is recommended
Target Audience
Backend engineers building HTTP services in Rust — internal APIs, public APIs, BFFs in front of LLMs, and high-throughput services where GC pauses or runtime overhead are a problem. Particularly relevant for teams looking for a memory-safe alternative to Go, Node, or Java services without sacrificing developer ergonomics.
Description
This course teaches engineers to build production-ready REST APIs in Rust on the 2024 edition (Rust 1.85 introduced the edition; 1.95+ recommended for the current toolchain) with Actix-web 4. The course covers the full stack: routing and extractors, request handlers, middleware (logging, sessions, error handling), database access with sqlx and PostgreSQL, structured logging and tracing with tracing, testing strategies, containerization, and deployment. Throughout, students use AI coding assistants (Claude Code, Cursor, GitHub Copilot) the way senior Rust engineers actually use them in 2026 — letting Cargo, clippy, and the compiler be the source of truth while AI handles the routine boilerplate.
Learning Outcomes
- Build a production-quality REST API in Rust with Actix-web 4 from scratch.
- Define routes, extractors, and request handlers idiomatically.
- Apply middleware for logging, sessions, error handling, authentication, and rate limiting.
- Connect to PostgreSQL with sqlx, including compile-time-checked SQL and migrations.
- Add structured logging and distributed tracing with the
tracingcrate. - Write integration tests against a real test database and unit tests for handlers and middleware.
- Containerize, deploy, and operate the service in production.
- Use AI coding assistants effectively for Actix-web development without sacrificing safety or correctness.
Training Materials
All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples. Students practice the topics covered through challenging hands-on lab exercises that build into a complete, deployable Actix-web API capstone.
Software Requirements
A free GitHub account, the latest stable Rust toolchain installed via rustup (Rust 1.95+ on the 2024 edition), Visual Studio Code or another supported editor with the rust-analyzer extension, Docker for the local PostgreSQL instance, curl and/or HTTPie or Postman, and an AI coding assistant of choice (GitHub Copilot, Cursor, or Claude Code). A cloud-based environment can be provided if local installation is restricted.
Training Topics
REST and HTTP in Practice
- What REST is and what it isn't in 2026
- HTTP methods, status codes, headers, and bodies
- URLs, query strings, and path parameters
- JSON, form-encoded, and multipart bodies
- Working with
curl, HTTPie, and Postman
Actix-web 4 Overview
- Where Actix-web 4 sits relative to axum, Rocket, Express, FastAPI, and ASP.NET
- The actor model and the Actix runtime
- Project layout, crates, and feature flags
- Running and debugging in VS Code
Routing
- Mapping HTTP routes to Rust handlers
- Path parameters, query strings, and method routing
- Resource trees and route configuration
- Versioning your API
Extractors
- The extractor model in Actix-web 4
Path,Query,Json,Form, andBytesextractors- State and shared data
- Custom extractors
Request Handlers
- The handler lifecycle
- The
Respondertrait and custom responses - Streaming responses
- Returning JSON, files, and binary responses
Middleware
- The Actix-web middleware model
- Logging with
tracingandtracing-actix-web - Sessions with
actix-sessionand cookie or Redis backends - Error handling and custom error types with
thiserror - Authentication, authorization, and rate limiting
- Writing custom middleware
Static Files and Assets
- Serving static files with
actix-files - Asset bundling and content hashing
- Single-page-app fallback routing
Database with sqlx and PostgreSQL
- Connecting to PostgreSQL with sqlx
- Compile-time-checked SQL queries
- Migrations with
sqlx-cli - Transactions and connection pooling
- Mapping rows to typed structs
Observability
- Structured logging with
tracing - Distributed tracing with OpenTelemetry exporters
- Metrics and health checks
- Capturing and shipping diagnostics in production
Testing
- Integration testing against a real PostgreSQL database
- Unit testing handlers, extractors, and middleware
- Snapshot tests and golden files
- Load testing with
ohaorwrk
Deployment
- Building optimized release binaries
- Multi-stage Docker builds
- Container registries and image hardening
- Hosting considerations: bare metal, VMs, container platforms, edge
- Configuration with
dotenvyand 12-factor environment variables
AI-Assisted Actix-web Development
- The 2026 AI-coding-tool landscape for backend Rust
- Prompts that work well for handler scaffolding, extractor design, and middleware
- Letting the compiler, clippy, and tests catch what AI gets wrong
- Reviewing AI-generated
unsafe,unwrap, and unbounded allocations - Agentic Rust workflows: AI-assisted refactors, code review, and CI
Capstone
- Build and deploy a complete Actix-web 4 REST API backed by PostgreSQL with sqlx, structured logging, JWT auth, integration tests, a CI pipeline, and a Docker image — built with AI assistance and validated by the compiler, clippy, tests, and a small load test
- Course wrap-up and recommended next courses