๐ Tako โ Lightweight Async Web Framework in Rust
Tako ("octopus" in Japanese) is a pragmatic, ergonomic and extensible async web framework for Rust. It aims to keep the mental model small while giving you firstโclass performance and modern conveniences outโofโtheโbox.
Blog posts:
โจ Highlights
- Multi-protocol โ HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebSocket, WebTransport, SSE, gRPC, TCP, UDP, Unix sockets, PROXY protocol.
- Dual runtime โ First-class support for both Tokio and Compio async runtimes (including TLS + HTTP/2 on both).
- 22+ extractors โ Strongly-typed request extractors: JSON, form, query, path, headers, cookies (signed/private), JWT, Basic/Bearer auth, API key, Accept, Range, protobuf, and more.
- Rich middleware โ Auth (JWT, Basic, Bearer, API key), CSRF, sessions, body limits, request IDs, security headers, upload progress, compression, rate limiting, CORS, idempotency, metrics.
- SIMD JSON โ Route-level configurable SIMD-accelerated JSON parsing (sonic-rs / simd-json) with automatic size-based dispatch.
- Background job queue โ In-memory task queue with named handlers, retry policies (fixed / exponential backoff), delayed jobs, dead letter queue, and graceful shutdown.
- Streaming & SSE โ Built-in helpers for Server-Sent Events and arbitrary
Streamresponses. - GraphQL โ Async-GraphQL integration with extractors, responses, and WebSocket subscriptions.
- OpenAPI โ Automatic API documentation via utoipa or vespera integration.
- TLS โ Native rustls-based HTTPS with ALPN negotiation.
- Compression โ Brotli, gzip, deflate, and zstd response compression.
- Signals โ In-process pub/sub signal system for decoupled event-driven architectures.
- Static files & file streaming โ Serve directories and stream files with range request support.
- Graceful shutdown โ Drain in-flight connections before exit across all server variants.
Feature Matrix
Transports & Protocols
| Protocol | Tokio | Compio | Feature flag |
|---|---|---|---|
| HTTP/1.1 | โ | โ | default |
| HTTP/2 | โ | โ | http2 |
| HTTP/3 (QUIC) | โ | โ | http3 |
| TLS (rustls) | โ | โ | tls / compio-tls |
| WebSocket | โ | โ | default / compio-ws |
| WebTransport | โ | โ | webtransport |
| SSE | โ | โ | default |
| gRPC (unary) | โ | โ | grpc |
| Raw TCP | โ | โ | default |
| Raw UDP | โ | โ | default |
| Unix sockets | โ | โ | default (unix only) |
| PROXY protocol v1/v2 | โ | โ | default |
Extractors (22+)
| Extractor | Description |
|---|---|
Json<T> |
JSON body (with optional SIMD acceleration) |
Form<T> |
URL-encoded form body |
Query<T> |
URL query parameters |
Path<T> |
Route path parameters |
Params |
Dynamic path params map |
HeaderMap |
Full request headers |
Bytes |
Raw request body |
State<T> |
Shared application state |
CookieJar |
Cookie reading/writing |
SignedCookieJar |
HMAC-signed cookies |
PrivateCookieJar |
Encrypted cookies |
BasicAuth |
HTTP Basic authentication |
BearerAuth |
Bearer token extraction |
JwtClaims<T> |
JWT token validation & claims |
ApiKey |
API key from header/query |
Accept |
Content negotiation |
AcceptLanguage |
Language negotiation |
Range |
HTTP Range header |
IpAddr |
Client IP address |
Protobuf<T> |
Protocol Buffers body |
SimdJson<T> |
Force SIMD JSON parsing |
Multipart |
Multipart form data |
Middleware
| Middleware | Description |
|---|---|
| JWT Auth | Validate JWT tokens on routes |
| Basic Auth | HTTP Basic authentication |
| Bearer Auth | Bearer token validation |
| API Key Auth | Header or query-based API key |
| CSRF | Double-submit cookie CSRF protection |
| Session | Cookie-based sessions (in-memory store) |
| Security Headers | HSTS, X-Frame-Options, CSP, etc. |
| Request ID | Generate/propagate X-Request-ID |
| Body Limit | Enforce max request body size |
| Upload Progress | Track upload progress callbacks |
| CORS | Cross-Origin Resource Sharing |
| Rate Limiter | Token-bucket rate limiting |
| Compression | Brotli / gzip / deflate / zstd |
| Idempotency | Idempotency key deduplication |
| Metrics | Prometheus / OpenTelemetry export |
Feature Flags
| Flag | Description |
|---|---|
http2 |
HTTP/2 support (ALPN h2) |
http3 |
HTTP/3 over QUIC (enables webtransport) |
tls |
HTTPS via rustls |
compio |
Compio async runtime (alternative to tokio) |
compio-tls |
TLS on compio |
compio-ws |
WebSocket on compio |
grpc |
gRPC unary RPCs with protobuf |
protobuf |
Protobuf extractor (prost) |
plugins |
CORS, compression, rate limiting |
simd |
SIMD JSON parsing (sonic-rs + simd-json) |
multipart |
Multipart form-data extractors |
file-stream |
File streaming & range requests |
async-graphql |
GraphQL integration |
graphiql |
GraphiQL IDE endpoint |
signals |
In-process pub/sub signal system |
jemalloc |
jemalloc global allocator |
zstd |
Zstandard compression (in plugins) |
tako-tracing |
Distributed tracing subscriber |
utoipa |
OpenAPI docs via utoipa |
vespera |
OpenAPI docs via vespera |
metrics-prometheus |
Prometheus metrics export |
metrics-opentelemetry |
OpenTelemetry metrics export |
zero-copy-extractors |
Zero-copy body extraction |
client |
Outbound HTTP client |
Documentation
MSRV 1.87.0 | Edition 2024
Tako in Production
Tako already powers real-world services in production:
stochastic-api: https://stochasticlab.cloud/shrtn.ink: https://app.shrtn.ink/
๐ฅ Benchmarking the Hello World
+---------------------------+------------------+------------------+---------------+
| Framework ๐ฆ | Requests/sec | Avg Latency | Transfer/sec |
+---------------------------+------------------+------------------+---------------+
| Tako (not taco! ๐ฎ) | ~148,800 | ~649 ยตs | ~12.6 MB/s |
| Tako Jemalloc | ~158,059 | ~592 ยตs | ~13.3 MB/s |
| Axum | ~153,500 | ~607 ยตs | ~19 MB/s |
| Actix | ~126,300 | ~860 ยตs | ~15.7 MB/s |
+---------------------------+------------------+------------------+---------------+
๐ Command used: `wrk -t4 -c100 -d30s http://127.0.0.1:8080/`
๐ฆ Installation
Add Tako to your Cargo.toml:
[]
= "*"
๐ Quick Start
Spin up a "Hello, World!" server in a handful of lines:
use Result;
use ;
use TcpListener;
async
async
๐ License
MIT โ see LICENSE for details.
Made with โค๏ธ & ๐ฆ by the Tako contributors.