HTTP ยท WebSocket ยท SSE ยท gRPC ยท HTTP/3 ยท TCP/UDP
๐ tako
Tako is a Rust web framework for services that speak more than HTTP. One router, one middleware stack, and one observability model cover HTTP/1.1, HTTP/2, HTTP/3, WebSocket, SSE, gRPC, TCP, UDP, Unix sockets, and WebTransport, on Tokio or Compio.
Hello, Tako
The package is tako-rs; the Rust import is tako. Add it with cargo add tako-rs or in Cargo.toml:
[dependencies]
tako-rs = "2.5"
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread"] }use tako::{router::Router, types::BoxError, Server};
use tokio::net::TcpListener;
#[tokio::main]
async fn main() -> Result<(), BoxError> {
let mut router = Router::new();
router.get("/", || async { "Hello, Tako!" });
let listener = TcpListener::bind("127.0.0.1:8080").await?;
Server::builder()
.build()
.try_spawn_http(listener, router)?
.result()
.await?;
Ok(())
}Run it with cargo run, then curl http://127.0.0.1:8080/. Continue with the Quickstart.
Multi-transport by design
HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebSocket, WebTransport, SSE, gRPC, raw TCP / UDP, Unix sockets, and PROXY protocol โ all behind one Router and one middleware stack.
Two runtimes, one model
The same framework style on Tokio or Compio, including TLS and HTTP/2 on both sides where supported. Pick the runtime that fits the deployment, keep the code.
Typed extraction
22+ extractors for JSON (with optional SIMD), form, query, path, headers, cookies, JWT claims, API keys, Accept, Range, protobuf, and multipart.
Middleware & auth included
JWT / Basic / Bearer / API-key auth, CSRF, sessions, security headers, request IDs, body limits, rate limiting, CORS, idempotency, and compression โ part of the framework, not glue.
Realtime-ready
Streaming responses, SSE, WebSockets, GraphQL subscriptions, HTTP/3, and WebTransport under one crate. Background queue, in-process signals, and graceful shutdown ship in the box.
Performance paths
SIMD JSON (sonic-rs / simd-json), optional zero-copy extractors, brotli / gzip / deflate / zstd compression, and jemalloc support โ without fragmenting the API.
Benchmarks
Hello-world requests per second under loopback, server-bound, and pipelined load, measured with tako-rs 2.4.0 in a 24 vCPU Linux container. The thread-per-core server leads Actix Web by 3% on loopback, 7% server-bound, and 17% pipelined; the default server serves about 24% more than Axum.
Results move with hardware and configuration. Methodology and reproduction steps.
FAQ
- Is the crate called tako or tako-rs?
- The crates.io package is tako-rs, and the library it provides is imported as tako (use tako::โฆ). The separate tako crate on crates.io is an unrelated project.
- How does Tako compare to Axum and Actix Web?
- Axum and Actix Web are mature HTTP frameworks with larger ecosystems. Tako focuses on running several transports (HTTP/3, WebSocket, SSE, gRPC, raw sockets) behind one router, with auth, sessions, rate limiting, and metrics built in. Read the comparison.
- Which async runtimes does Tako support?
- Tokio by default, and Compio (io_uring on Linux, IOCP on Windows) through the compio feature. Every transport, including HTTP/3 and WebTransport, runs on both. Runtime compatibility.
- Does Tako have a thread-per-core mode?
- Yes. The per-thread feature runs the router on one current-thread runtime per core with SO_REUSEPORT and balances connections across workers. In the published benchmarks it serves 3% more requests than Actix Web on loopback and 7% more when the server is the bottleneck. Thread-per-core deployment.
- Which Rust version does Tako need?
- Rust 1.95 or newer. The workspace uses edition 2024.
- Is there an LLM-friendly version of the docs?
- Yes. /llms.txt indexes every page, /llms-full.txt holds the whole guide in one Markdown file, and any docs page is available as Markdown by appending .mdx to its URL. Using Tako with AI assistants.