Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 18, 2026·3 min de lecture

Poem — Full-Featured Async Web Framework for Rust

A fast and elegant Rust web framework with built-in OpenAPI generation, middleware, and session management powered by Tokio and Hyper.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Poem Rust Web Framework
Commande d'installation directe
npx -y tokrepo@latest install 949ba1c9-82e9-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Poem is a full-featured async web framework for Rust that prioritizes developer ergonomics without sacrificing performance. Built on Tokio and Hyper, it provides extractors, middleware, OpenAPI spec generation, and WebSocket support in a single cohesive package — filling the gap between minimalist frameworks and heavy enterprise stacks.

What Poem Does

  • Routes HTTP requests to async handler functions with type-safe extractors
  • Generates OpenAPI 3.0 documentation from code annotations automatically
  • Provides middleware for logging, CORS, compression, rate limiting, and auth
  • Supports WebSocket, SSE (Server-Sent Events), and multipart uploads
  • Integrates with Tower middleware ecosystem for reuse

Architecture Overview

Poem uses a layered architecture: a Router dispatches requests to Endpoints (handlers). Extractors pull typed data from requests (path params, query strings, JSON bodies). Middleware wraps endpoints for cross-cutting concerns. The OpenAPI module uses proc macros to derive schema definitions from Rust types at compile time, producing a spec without runtime reflection.

Self-Hosting & Configuration

  • Add to Cargo.toml: poem = "3" and poem-openapi = "5"
  • Define routes with method-specific macros (get, post, put, delete)
  • Configure TLS via poem with rustls or native-tls feature flags
  • Deploy as a single static binary — no runtime dependencies
  • Use tracing integration for structured logging

Key Features

  • Compile-time OpenAPI spec generation from handler signatures
  • Type-safe parameter extraction with helpful compile errors
  • Built-in session management with cookie and Redis backends
  • First-class WebSocket support with typed messages
  • Graceful shutdown handling for zero-downtime deploys

Comparison with Similar Tools

  • Axum — Also Tokio-based, more minimal; Poem has built-in OpenAPI and sessions
  • Actix Web — Higher raw throughput; Poem offers better ergonomics and compile times
  • Rocket — Synchronous by default (v0.5 adds async); Poem is async-first
  • Warp — Filter-based composition; Poem uses more traditional routing patterns

FAQ

Q: How does Poem compare to Axum in performance? A: Both use Hyper/Tokio and have nearly identical throughput. The difference is in API surface — Poem bundles more features while Axum is more composable.

Q: Can I use Poem with SQLx or Diesel? A: Yes. Pass a database pool as shared state via Data extractor, then use it in any handler.

Q: Does Poem support gRPC? A: Not directly. Use tonic alongside Poem, or route gRPC traffic separately. Poem focuses on HTTP/REST and WebSocket.

Q: How mature is Poem for production use? A: Poem is stable with semantic versioning. It powers production services handling high request volumes. The ecosystem is smaller than Actix or Axum but growing.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires