Expand description
A lightweight, modular web framework for async applications.
Tako focuses on ergonomics and composability. It provides routing, extractors, responses, middleware, streaming, WebSockets/SSE, optional TLS, and integrations like GraphQL — in a small, pragmatic package.
§High-level features
- Macro-free routing with dynamic path params and TSR support
- Type-safe handlers with extractor-based arguments (Axum-like ergonomics)
- Simple
Respondertrait to return strings, tuples, or full responses - Middleware pipeline (auth, body limits, etc.) and optional plugins (CORS, compression, rate limits)
- Streaming bodies, file serving, range requests, and SSE
- WebSocket upgrades and helpers
- Optional TLS (rustls) and HTTP/2 (feature)
- Optional GraphQL support (async-graphql) and GraphiQL UI
§Compatibility
- Runtime:
tokio - HTTP:
hyper1.x
§Quickstart
use tako::{Method, router::Router, responder::Responder, types::Request};
async fn hello(_: Request) -> impl Responder { "Hello, World!" }
let mut router = Router::new();
router.route(Method::GET, "/", hello);§Key concepts
-
router::Router manages routes, middleware and dispatch.
-
extractors parse request data (headers, params, JSON, forms, etc.).
-
responder::Responder converts return values into HTTP responses.
-
middleware composes cross-cutting concerns.
-
Static file serving (module
static) and file_stream provide static and streaming file responses. -
plugins add CORS, compression, and rate limiting (feature:
plugins). -
graphql and graphiql add GraphQL support (feature:
async-graphql/graphiql).
§Feature flags
client— outbound HTTP clients over TCP/TLSfile-stream— file streaming utilitieshttp2— enable ALPN h2 in TLS serverjemalloc— use jemalloc as global allocatormultipart— multipart form-data extractorsplugins— CORS, compression, rate limitingprotobuf— protobuf extractors (prost)simd— SIMD JSON extractor (simd-json)tls— TLS server (rustls)tako-tracing— structured tracing subscriberzstd— Zstandard compression option within plugins::compression
Re-exports§
Modules§
- body
- HTTP request and response body handling utilities. HTTP request and response body handling utilities for efficient data processing.
- client
client - HTTP client implementation for making outbound requests. HTTP client implementations for making outbound requests with TLS support.
- extractors
- Request data extraction utilities for parsing query params, JSON, and more. HTTP request data extraction utilities and traits.
- file_
stream file-stream - File streaming utilities for serving files. File streaming utilities for efficient HTTP file delivery.
- graphiql
graphiql - GraphiQL UI helpers. GraphiQL HTML responder and helper for Tako.
- graphql
async-graphql - GraphQL support (request extractors, responses, and subscriptions). Async-GraphQL integration for Tako: extractors, responses, and subscriptions.
- header
- HTTP header types
- middleware
- Middleware for processing requests and responses in a pipeline. Middleware system for request and response processing pipelines.
- plugins
plugins - Plugin system for extending framework functionality. Plugin system for extending framework functionality with composable modules.
- redirect
- Redirection utilities for handling HTTP redirects. Redirect response utilities for handlers.
- responder
- Response generation utilities and traits. Response generation utilities and trait implementations for HTTP responses.
- router
- Request routing and dispatch functionality. HTTP request routing and dispatch functionality.
- server_
tls tls - TLS/SSL server implementation for secure connections. TLS-enabled HTTP server implementation for secure connections.
- signals
signals - In-process signal arbiter for custom events. In-process signal arbiter and dispatch system.
- sse
- Server-Sent Events (SSE) support for real-time communication. Server-Sent Events (SSE) implementation for real-time data streaming.
- state
- Application state management and dependency injection. Global application state management and dependency injection (type-based).
- static
- Static file serving utilities. Static file serving utilities for web applications.
- tracing
tako-tracing - Distributed tracing integration for observability. Distributed tracing integration for observability and debugging.
- types
- Core type definitions used throughout the framework. Core type definitions and aliases used throughout the Tako framework.
- ws
- WebSocket connection handling and message processing. WebSocket connection handling and message processing utilities.
Structs§
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- Full
- A body that consists of a single chunk.
- Method
- The Request Method (VERB)
- Status
Code - An HTTP status code (
status-codein RFC 9110 et al.).
Functions§
- bind_
with_ port_ fallback - Bind a TCP listener for
addr, asking interactively to increment the port if it is already in use. - serve
- Starts the HTTP server with the given listener and router.