Skip to content

Commit b2164ac

Browse files
committed
fix: docs
1 parent e6c5e24 commit b2164ac

4 files changed

Lines changed: 52 additions & 177 deletions

File tree

README.md

Lines changed: 43 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -7,181 +7,34 @@
77
> **Tako** (*"octopus"* in Japanese) is a pragmatic, ergonomic and extensible Rust framework for services that go beyond plain HTTP.
88
> Build one cohesive application across HTTP/1.1, HTTP/2, HTTP/3, WebSocket, SSE, gRPC, TCP, UDP, Unix sockets, and WebTransport with a single routing, middleware, and observability model.
99
10+
📖 **Full documentation → [tako.rust-dd.com](https://tako.rust-dd.com)**  ·  [API docs (docs.rs)](https://docs.rs/tako-rs/latest/tako/)
11+
1012
## Why Tako
1113

12-
Tako is built for teams that want fewer moving parts in production:
13-
14-
* **One service, many transports** — Serve REST, WebSockets, SSE, gRPC, raw TCP/UDP, Unix sockets, and QUIC-based workloads without switching frameworks.
15-
* **One mental model, two runtimes** — Use the same framework style on **Tokio** or **Compio** depending on the deployment constraints.
16-
* **Application primitives included** — Middleware, auth, metrics, signals, queues, graceful shutdown, and streaming are part of the framework story, not an afterthought.
17-
* **Performance knobs when they matter** — SIMD JSON, optional zero-copy extractors, compression, jemalloc, and HTTP/3 support are available without fragmenting the API.
18-
* **Strong fit for real systems** — API backends, realtime apps, protocol gateways, internal platforms, and edge-facing services.
19-
20-
## ✨ Highlights
21-
22-
* **Multi-transport by design** — HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebSocket, WebTransport, SSE, gRPC, TCP, UDP, Unix sockets, and PROXY protocol.
23-
* **Dual runtime support** — First-class support for both **Tokio** and **Compio**, including TLS and HTTP/2 on both sides where supported.
24-
* **Built-in platform primitives** — Background job queue, in-process signals, metrics hooks, graceful shutdown, static files, and stream helpers.
25-
* **Rich middleware and auth** — JWT, Basic, Bearer, API key, CSRF, sessions, body limits, request IDs, security headers, upload progress, rate limiting, CORS, idempotency, and compression.
26-
* **Strongly typed extraction** — 22+ extractors for JSON, form, query, path, headers, cookies, JWT claims, API keys, Accept, Range, protobuf, multipart, and more.
27-
* **Performance paths included** — SIMD JSON (`sonic-rs` / `simd-json`), optional zero-copy extractors, brotli/gzip/deflate/zstd, and jemalloc support.
28-
* **Realtime-ready** — Streaming responses, SSE, WebSockets, GraphQL subscriptions, HTTP/3, and WebTransport under one crate.
29-
* **Docs and API surface included** — OpenAPI via `utoipa` or `vespera`, GraphiQL support, and a growing example suite for common deployment patterns.
30-
31-
## Best Fit
32-
33-
Choose Tako when your service needs one or more of these:
34-
35-
* **More than REST** — You need HTTP APIs plus WebSockets, SSE, gRPC, TCP, UDP, or QUIC in the same application.
36-
* **Realtime coordination** — You want built-in signals, queues, and streaming primitives instead of composing everything manually.
37-
* **Framework consolidation** — You would rather depend on one coherent crate than glue together several partially overlapping libraries.
38-
* **Protocol-heavy infrastructure** — Gateways, internal platforms, telemetry collectors, control planes, or edge services are a particularly strong fit.
39-
40-
## Feature Matrix
41-
42-
### Transports & Protocols
43-
44-
| Protocol | Tokio | Compio | Feature flag |
45-
|---|---|---|---|
46-
| HTTP/1.1 ||| *default* |
47-
| HTTP/2 ||| `http2` |
48-
| HTTP/3 (QUIC) ||| `http3` |
49-
| TLS (rustls) ||| `tls` / `compio-tls` |
50-
| WebSocket ||| *default* / `compio-ws` |
51-
| WebTransport ||| `webtransport` |
52-
| SSE ||| *default* |
53-
| gRPC (unary) ||| `grpc` |
54-
| Raw TCP ||| *default* |
55-
| Raw UDP ||| *default* |
56-
| Unix sockets ||| *default* (unix only) |
57-
| PROXY protocol v1/v2 ||| *default* |
58-
59-
### Extractors (22+)
60-
61-
| Extractor | Description |
62-
|---|---|
63-
| `Json<T>` | JSON body (with optional SIMD acceleration) |
64-
| `Form<T>` | URL-encoded form body |
65-
| `Query<T>` | URL query parameters |
66-
| `Path<T>` | Route path parameters |
67-
| `Params` | Dynamic path params map |
68-
| `HeaderMap` | Full request headers |
69-
| `Bytes` | Raw request body |
70-
| `State<T>` | Shared application state |
71-
| `CookieJar` | Cookie reading/writing |
72-
| `SignedCookieJar` | HMAC-signed cookies |
73-
| `PrivateCookieJar` | Encrypted cookies |
74-
| `BasicAuth` | HTTP Basic authentication |
75-
| `BearerAuth` | Bearer token extraction |
76-
| `JwtClaimsUnverified<T>` | Unverified JWT claims decode (signature **not** checked) |
77-
| `JwtClaimsVerified<T>` | Signature-verified JWT claims (via `tako-plugins::JwtAuth`) |
78-
| `ApiKey` | API key from header/query |
79-
| `Accept` | Content negotiation |
80-
| `AcceptLanguage` | Language negotiation |
81-
| `Range` | HTTP Range header |
82-
| `IpAddr` | Client IP address |
83-
| `Protobuf<T>` | Protocol Buffers body |
84-
| `SimdJson<T>` | Force SIMD JSON parsing |
85-
| `Multipart` | Multipart form data |
86-
87-
### Middleware
88-
89-
| Middleware | Description |
90-
|---|---|
91-
| JWT Auth | Validate JWT tokens on routes |
92-
| Basic Auth | HTTP Basic authentication |
93-
| Bearer Auth | Bearer token validation |
94-
| API Key Auth | Header or query-based API key |
95-
| CSRF | Double-submit cookie CSRF protection |
96-
| Session | Cookie-based sessions (in-memory store) |
97-
| Security Headers | HSTS, X-Frame-Options, CSP, etc. |
98-
| Request ID | Generate/propagate `X-Request-ID` |
99-
| Body Limit | Enforce max request body size |
100-
| Upload Progress | Track upload progress callbacks |
101-
| CORS | Cross-Origin Resource Sharing |
102-
| Rate Limiter | Token-bucket rate limiting |
103-
| Compression | Brotli / gzip / deflate / zstd |
104-
| Idempotency | Idempotency key deduplication |
105-
| Metrics | Prometheus / OpenTelemetry export |
106-
107-
### Feature Flags
108-
109-
| Flag | Description |
110-
|---|---|
111-
| `http2` | HTTP/2 support (ALPN h2) |
112-
| `http3` | HTTP/3 over QUIC (enables `webtransport`) |
113-
| `tls` | HTTPS via rustls |
114-
| `compio` | Compio async runtime (alternative to tokio) |
115-
| `compio-tls` | TLS on compio |
116-
| `compio-ws` | WebSocket on compio |
117-
| `grpc` | gRPC unary RPCs with protobuf |
118-
| `protobuf` | Protobuf extractor (prost) |
119-
| `plugins` | CORS, compression, rate limiting |
120-
| `simd` | SIMD JSON parsing (sonic-rs + simd-json) |
121-
| `multipart` | Multipart form-data extractors |
122-
| `file-stream` | File streaming & range requests |
123-
| `async-graphql` | GraphQL integration |
124-
| `graphiql` | GraphiQL IDE endpoint |
125-
| `signals` | In-process pub/sub signal system |
126-
| `jemalloc` | jemalloc global allocator |
127-
| `zstd` | Zstandard compression (in plugins) |
128-
| `tako-tracing` | Distributed tracing subscriber |
129-
| `utoipa` | OpenAPI docs via utoipa |
130-
| `vespera` | OpenAPI docs via vespera |
131-
| `metrics-prometheus` | Prometheus metrics export |
132-
| `metrics-opentelemetry` | OpenTelemetry metrics export |
133-
| `zero-copy-extractors` | Zero-copy body extraction |
134-
| `client` | Outbound HTTP client |
135-
136-
## Documentation
137-
138-
- **Guide & reference:** [tako.rust-dd.com](https://tako.rust-dd.com) — the full handbook: getting started, transports, extractors, middleware, concepts, and reference.
139-
- **API docs:** [docs.rs/tako-rs](https://docs.rs/tako-rs/latest/tako/)
140-
141-
The documentation site lives in [`website/`](./website) (Fumadocs + Next.js + MDX).
142-
143-
MSRV 1.95 | Edition 2024
144-
145-
See [`STABILITY.md`](./STABILITY.md) for the full semver and MSRV policy,
146-
[`MIGRATION_1_TO_2.md`](./MIGRATION_1_TO_2.md) for upgrading from 1.x, and
147-
[`CHANGELOG.md`](./CHANGELOG.md) for release notes.
148-
149-
## Tako in Production
150-
151-
Tako already powers real-world services in production:
152-
153-
- `stochastic-api`: https://stochasticlab.cloud/
154-
- `shrtn.ink`: https://app.shrtn.ink/
155-
156-
## Baseline Hello World Benchmark
157-
158-
Hello world throughput is not the whole story, but the current branch lands in this range on a clean local run:
159-
160-
| Framework | Requests/sec | Avg Latency | Note |
161-
| --- | ---: | ---: | --- |
162-
| Tako | ~187,288 | ~505 us | latest local `30s` rerun |
163-
| Tako + `jemalloc` | ~187,638 | ~502 us | latest local `30s` rerun |
164-
| Axum | ~186,194 | ~498 us | latest local `30s` rerun |
165-
| Actix | ~155,307 | ~635 us | latest local `30s` rerun |
166-
167-
Command used: `wrk -t4 -c100 -d30s http://127.0.0.1:8080/`
168-
169-
Benchmarks are machine- and thermal-state-dependent, so treat these as local baselines, not universal claims. Axum and Actix were rerun with minimal temporary hello-world servers using the same `wrk` command.
170-
171-
172-
## 📦 Installation
173-
174-
Add **Tako** to your `Cargo.toml`:
14+
- **One service, many transports** — REST, WebSockets, SSE, gRPC, raw TCP/UDP, Unix sockets, and QUIC without switching frameworks.
15+
- **One model, two runtimes** — the same framework style on **Tokio** or **Compio**, TLS and HTTP/2 on both.
16+
- **Batteries included** — middleware, auth, metrics, signals, queues, graceful shutdown, and streaming are part of the framework, not an afterthought.
17+
- **Performance when it matters** — SIMD JSON, optional zero-copy extractors, brotli/gzip/deflate/zstd, jemalloc, and HTTP/3 — without fragmenting the API.
18+
19+
## At a glance
20+
21+
- **Transports** — HTTP/1.1, HTTP/2, HTTP/3 (QUIC), WebSocket, WebTransport, SSE, gRPC, TCP, UDP, Unix sockets, PROXY protocol.
22+
- **Extraction** — 22+ typed extractors: JSON (SIMD optional), form, query, path, headers, cookies, JWT claims, API keys, Accept, Range, protobuf, multipart.
23+
- **Middleware** — JWT/Basic/Bearer/API-key auth, CSRF, sessions, security headers, request IDs, body limits, rate limiting, CORS, idempotency, compression, metrics.
24+
25+
The full transport matrix, extractor catalog, middleware reference, and cargo
26+
feature graph live in the [documentation](https://tako.rust-dd.com).
27+
28+
## Installation
17529

17630
```toml
17731
[dependencies]
17832
tako-rs = "2"
17933
```
18034

35+
MSRV 1.95 · Edition 2024
18136

182-
## 🚀 Quick Start
183-
184-
Spin up a "Hello, World!" server in a handful of lines:
37+
## Quick Start
18538

18639
```rust
18740
use anyhow::Result;
@@ -199,23 +52,41 @@ async fn hello_world(_: Request) -> impl Responder {
19952

20053
#[tokio::main]
20154
async fn main() -> Result<()> {
202-
// Bind a local TCP listener
20355
let listener = TcpListener::bind("127.0.0.1:8080").await?;
20456

205-
// Declare routes
20657
let mut router = Router::new();
20758
router.route(Method::GET, "/", hello_world);
20859

209-
// Launch the server
21060
tako::serve(listener, router).await;
211-
21261
Ok(())
21362
}
21463
```
21564

216-
## 📜 License
65+
Keep going with the [Quickstart guide](https://tako.rust-dd.com/docs/getting-started/quickstart).
66+
67+
## In Production
68+
69+
Tako already powers real-world services:
70+
71+
- `stochastic-api`https://stochasticlab.cloud/
72+
- `shrtn.ink`https://app.shrtn.ink/
73+
74+
## Benchmark
75+
76+
Hello-world throughput on a clean local run (`wrk -t4 -c100 -d30s`):
77+
78+
| Framework | Requests/sec | Avg Latency |
79+
| --- | ---: | ---: |
80+
| Tako | ~187,288 | ~505 µs |
81+
| Tako + `jemalloc` | ~187,638 | ~502 µs |
82+
| Axum | ~186,194 | ~498 µs |
83+
| Actix | ~155,307 | ~635 µs |
84+
85+
Machine- and thermal-state-dependent — treat as local baselines, not universal
86+
claims. Details on the [benchmarks page](https://tako.rust-dd.com/docs/benchmarks).
21787

218-
`MIT` — see [LICENSE](./LICENSE) for details.
88+
## License
21989

90+
`MIT` — see [LICENSE](./LICENSE).
22091

22192
Made with ❤️ & 🦀 by the Tako contributors.

website/content/docs/middleware/metrics.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ meter_provider.shutdown()?;
6666

6767
`with_meter_name(name)` sets the meter name (default `"tako"`).
6868

69-
<RustExample path="examples/metrics-opentelemetry" />
69+
<RustExample path="examples/metrics-opentelemetry/src/main.rs" />
7070

7171
<Callout type="info">
7272
Both backends depend on the signal system, so the metrics features enable
@@ -140,7 +140,7 @@ let pct = req
140140
.unwrap_or(0);
141141
```
142142

143-
<RustExample path="examples/upload-progress" />
143+
<RustExample path="examples/upload-progress/src/main.rs" />
144144

145145
See the [middleware model](/docs/middleware) for chain ordering and
146146
[Observability](/docs/observability) for signals, tracing, and the broader

website/content/docs/streams.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ precompressed sidecars (`<file>.br`, `<file>.gz`) when present.
9797
`tako::r#static::ServeDirBuilder` mounts a directory with SPA
9898
fallback (`fallback("/index.html")`) and traversal hardening.
9999

100-
<RustExample path="examples/file-stream" />
100+
<RustExample path="examples/file-stream/src/main.rs" />
101101

102102
## WebTransport
103103

website/scripts/docs-audit.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ for (const file of walk(ROOT)) {
9393
let m: RegExpExecArray | null;
9494
while ((m = rustExampleRe.exec(src)) !== null) {
9595
const target = join(WORKSPACE, m[1]);
96+
let isFile = false;
9697
try {
97-
statSync(target);
98+
isFile = statSync(target).isFile();
9899
} catch {
100+
isFile = false;
101+
}
102+
if (!isFile) {
99103
errors++;
100-
console.error(`✘ ${rel}: RustExample path "${m[1]}" does not exist`);
104+
console.error(`✘ ${rel}: RustExample path "${m[1]}" is not a file`);
101105
}
102106
}
103107
rustExampleRe.lastIndex = 0;

0 commit comments

Comments
 (0)