|
7 | 7 | > **Tako** (*"octopus"* in Japanese) is a pragmatic, ergonomic and extensible async web framework for Rust. |
8 | 8 | > It aims to keep the mental model small while giving you first‑class performance and modern conveniences out‑of‑the‑box. |
9 | 9 |
|
10 | | -> **⚠️ ~~Early-stage software~~** |
11 | | -> **⚠️ Beta software:** Tako is still under active development; use with caution and expect breaking changes. |
12 | | -
|
13 | 10 | > **Blog posts:** |
14 | 11 | > - [Tako: A Lightweight Async Web Framework on Tokio and Hyper](https://rust-dd.com/post/tako-a-lightweight-async-web-framework-on-tokio-and-hyper) |
15 | 12 | > - [Tako v.0.5.0 road to v.1.0.0](https://rust-dd.com/post/tako-v-0-5-0-road-to-v-1-0-0) |
|
18 | 15 |
|
19 | 16 | ## ✨ Highlights |
20 | 17 |
|
21 | | -* **Batteries‑included Router** — Intuitive path‑based routing with path parameters and trailing‑slash redirection (TSR). |
22 | | -* **Extractor system** — Strongly‑typed request extractors for headers, query/body params, JSON, form data, etc. |
23 | | -* **Streaming & SSE** — Built‑in helpers for Server‑Sent Events *and* arbitrary `Stream` responses. |
24 | | -* **Middleware** — Compose synchronous or async middleware functions with minimal boilerplate. |
25 | | -* **Shared State** — Application‑wide state injection without `unsafe` globals. |
26 | | -* **Plugin system** — Opt‑in extensions let you add functionality without cluttering the core API. |
27 | | -* **Hyper‑powered** — Built on `hyper` & `tokio` for minimal overhead and async performance with **native HTTP/2, HTTP/3 & TLS** support. |
28 | | -* **Compio runtime** — Optional support for compio async runtime as an alternative to tokio. |
29 | | -* **GraphQL integration** — Async-GraphQL integration for Tako: extractors, responses, and subscriptions. |
30 | | -* **OpenAPI support** — Integration with utoipa and vespera for automatic API documentation generation. |
31 | | -* **Compression** — Built-in support for brotli, gzip (flate2), and zstd compression. |
| 18 | +* **Multi-protocol** — HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebSocket, WebTransport, SSE, gRPC, TCP, UDP, Unix sockets, PROXY protocol. |
| 19 | +* **Dual runtime** — First-class support for both **Tokio** and **Compio** async runtimes (including TLS + HTTP/2 on both). |
| 20 | +* **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. |
| 21 | +* **Rich middleware** — Auth (JWT, Basic, Bearer, API key), CSRF, sessions, body limits, request IDs, security headers, upload progress, compression, rate limiting, CORS, idempotency, metrics. |
| 22 | +* **SIMD JSON** — Route-level configurable SIMD-accelerated JSON parsing (sonic-rs / simd-json) with automatic size-based dispatch. |
| 23 | +* **Background job queue** — In-memory task queue with named handlers, retry policies (fixed / exponential backoff), delayed jobs, dead letter queue, and graceful shutdown. |
| 24 | +* **Streaming & SSE** — Built-in helpers for Server-Sent Events and arbitrary `Stream` responses. |
| 25 | +* **GraphQL** — Async-GraphQL integration with extractors, responses, and WebSocket subscriptions. |
| 26 | +* **OpenAPI** — Automatic API documentation via utoipa or vespera integration. |
| 27 | +* **TLS** — Native rustls-based HTTPS with ALPN negotiation. |
| 28 | +* **Compression** — Brotli, gzip, deflate, and zstd response compression. |
| 29 | +* **Signals** — In-process pub/sub signal system for decoupled event-driven architectures. |
| 30 | +* **Static files & file streaming** — Serve directories and stream files with range request support. |
| 31 | +* **Graceful shutdown** — Drain in-flight connections before exit across all server variants. |
| 32 | + |
| 33 | +## Feature Matrix |
| 34 | + |
| 35 | +### Transports & Protocols |
| 36 | + |
| 37 | +| Protocol | Tokio | Compio | Feature flag | |
| 38 | +|---|---|---|---| |
| 39 | +| HTTP/1.1 | ✅ | ✅ | *default* | |
| 40 | +| HTTP/2 | ✅ | ✅ | `http2` | |
| 41 | +| HTTP/3 (QUIC) | ✅ | — | `http3` | |
| 42 | +| TLS (rustls) | ✅ | ✅ | `tls` / `compio-tls` | |
| 43 | +| WebSocket | ✅ | ✅ | *default* / `compio-ws` | |
| 44 | +| WebTransport | ✅ | — | `webtransport` | |
| 45 | +| SSE | ✅ | ✅ | *default* | |
| 46 | +| gRPC (unary) | ✅ | — | `grpc` | |
| 47 | +| Raw TCP | ✅ | — | *default* | |
| 48 | +| Raw UDP | ✅ | — | *default* | |
| 49 | +| Unix sockets | ✅ | — | *default* (unix only) | |
| 50 | +| PROXY protocol v1/v2 | ✅ | — | *default* | |
| 51 | + |
| 52 | +### Extractors (22+) |
| 53 | + |
| 54 | +| Extractor | Description | |
| 55 | +|---|---| |
| 56 | +| `Json<T>` | JSON body (with optional SIMD acceleration) | |
| 57 | +| `Form<T>` | URL-encoded form body | |
| 58 | +| `Query<T>` | URL query parameters | |
| 59 | +| `Path<T>` | Route path parameters | |
| 60 | +| `Params` | Dynamic path params map | |
| 61 | +| `HeaderMap` | Full request headers | |
| 62 | +| `Bytes` | Raw request body | |
| 63 | +| `State<T>` | Shared application state | |
| 64 | +| `CookieJar` | Cookie reading/writing | |
| 65 | +| `SignedCookieJar` | HMAC-signed cookies | |
| 66 | +| `PrivateCookieJar` | Encrypted cookies | |
| 67 | +| `BasicAuth` | HTTP Basic authentication | |
| 68 | +| `BearerAuth` | Bearer token extraction | |
| 69 | +| `JwtClaims<T>` | JWT token validation & claims | |
| 70 | +| `ApiKey` | API key from header/query | |
| 71 | +| `Accept` | Content negotiation | |
| 72 | +| `AcceptLanguage` | Language negotiation | |
| 73 | +| `Range` | HTTP Range header | |
| 74 | +| `IpAddr` | Client IP address | |
| 75 | +| `Protobuf<T>` | Protocol Buffers body | |
| 76 | +| `SimdJson<T>` | Force SIMD JSON parsing | |
| 77 | +| `Multipart` | Multipart form data | |
| 78 | + |
| 79 | +### Middleware |
| 80 | + |
| 81 | +| Middleware | Description | |
| 82 | +|---|---| |
| 83 | +| JWT Auth | Validate JWT tokens on routes | |
| 84 | +| Basic Auth | HTTP Basic authentication | |
| 85 | +| Bearer Auth | Bearer token validation | |
| 86 | +| API Key Auth | Header or query-based API key | |
| 87 | +| CSRF | Double-submit cookie CSRF protection | |
| 88 | +| Session | Cookie-based sessions (in-memory store) | |
| 89 | +| Security Headers | HSTS, X-Frame-Options, CSP, etc. | |
| 90 | +| Request ID | Generate/propagate `X-Request-ID` | |
| 91 | +| Body Limit | Enforce max request body size | |
| 92 | +| Upload Progress | Track upload progress callbacks | |
| 93 | +| CORS | Cross-Origin Resource Sharing | |
| 94 | +| Rate Limiter | Token-bucket rate limiting | |
| 95 | +| Compression | Brotli / gzip / deflate / zstd | |
| 96 | +| Idempotency | Idempotency key deduplication | |
| 97 | +| Metrics | Prometheus / OpenTelemetry export | |
| 98 | + |
| 99 | +### Feature Flags |
| 100 | + |
| 101 | +| Flag | Description | |
| 102 | +|---|---| |
| 103 | +| `http2` | HTTP/2 support (ALPN h2) | |
| 104 | +| `http3` | HTTP/3 over QUIC (enables `webtransport`) | |
| 105 | +| `tls` | HTTPS via rustls | |
| 106 | +| `compio` | Compio async runtime (alternative to tokio) | |
| 107 | +| `compio-tls` | TLS on compio | |
| 108 | +| `compio-ws` | WebSocket on compio | |
| 109 | +| `grpc` | gRPC unary RPCs with protobuf | |
| 110 | +| `protobuf` | Protobuf extractor (prost) | |
| 111 | +| `plugins` | CORS, compression, rate limiting | |
| 112 | +| `simd` | SIMD JSON parsing (sonic-rs + simd-json) | |
| 113 | +| `multipart` | Multipart form-data extractors | |
| 114 | +| `file-stream` | File streaming & range requests | |
| 115 | +| `async-graphql` | GraphQL integration | |
| 116 | +| `graphiql` | GraphiQL IDE endpoint | |
| 117 | +| `signals` | In-process pub/sub signal system | |
| 118 | +| `jemalloc` | jemalloc global allocator | |
| 119 | +| `zstd` | Zstandard compression (in plugins) | |
| 120 | +| `tako-tracing` | Distributed tracing subscriber | |
| 121 | +| `utoipa` | OpenAPI docs via utoipa | |
| 122 | +| `vespera` | OpenAPI docs via vespera | |
| 123 | +| `metrics-prometheus` | Prometheus metrics export | |
| 124 | +| `metrics-opentelemetry` | OpenTelemetry metrics export | |
| 125 | +| `zero-copy-extractors` | Zero-copy body extraction | |
| 126 | +| `client` | Outbound HTTP client | |
32 | 127 |
|
33 | 128 | ## Documentation |
34 | 129 |
|
|
0 commit comments