Guide contents

Axum Microservices

Build and run production microservices in Rust with Axum.

30 lessons in 12 sections

Start with Your First Axum Server →

Axum Fundamentals

Build Axum routers, handlers, and application state.

  1. 1.Your First Axum Server

Foundations

Service boundaries, data ownership, and the costs of network communication.

  1. 2.What Is a Microservice
  2. 3.Splitting a System Into Services

HTTP API

Design REST resources, validate requests, and return consistent errors.

  1. 4.REST API Design: Resources, Validation, and Pagination
  2. 5.Error Handling and Rejections in Axum

Database

Model PostgreSQL data and build queries with SQLx and SeaORM.

  1. 6.PostgreSQL with SQLx: Migrations, Pools, and CRUD
  2. 7.Relationships, Indexes, and the N+1 Problem
  3. 8.Transactions, Locking, Idempotency, and the Outbox
  4. 9.SeaORM: Entities, Relations, and ActiveModel
  5. 10.Caching with Redis

Testing

Test Axum handlers, database behavior, and service contracts.

  1. 11.Testing Axum Services: Handlers, Databases, and Contracts

Security

Authenticate users and enforce authorization and tenant boundaries.

  1. 12.Authentication and Authorization in Axum
  2. 13.OAuth2, OIDC, JWT, and mTLS for Services

Middleware

Compose Tower layers for request processing and cross-cutting behavior.

  1. 14.Middleware with Tower and tower-http

Operations

Instrument, harden, configure, and deploy services.

  1. 15.Observability: Tracing, Logging, and Metrics
  2. 16.Resilience Patterns for Service Calls
  3. 17.Health Checks, Graceful Shutdown, and Configuration
  4. 18.Docker, Kubernetes, and CI/CD for Axum Services

gRPC with Tonic

Protocol Buffers, RPC types, deadlines, interceptors, TLS, and load balancing.

  1. 19.gRPC Basics: Protobuf and Unary RPC with Tonic
  2. 20.gRPC Streaming, Status Codes, Deadlines, and Interceptors
  3. 21.Production gRPC: TLS, Health, Load Balancing, and Testing

GraphQL

Schemas, resolvers, DataLoader, limits, subscriptions, and federation.

  1. 22.GraphQL Basics: Schema, Queries, and Mutations with async-graphql
  2. 23.GraphQL DataLoader, Errors, Limits, and Auth
  3. 24.GraphQL Subscriptions, Federation, and Protocol Comparison

Real-Time Delivery

Push updates with WebSockets and server-sent events.

  1. 25.WebSockets and Server-Sent Events in Axum

Distributed Patterns

Gateways, messaging, sagas, CQRS, and event sourcing.

  1. 26.API Gateway, Service Discovery, and Load Balancing
  2. 27.Messaging and Kafka
  3. 28.RabbitMQ and NATS
  4. 29.Sagas and Distributed Transactions
  5. 30.CQRS and Event Sourcing