diff --git a/website/astro.config.mjs b/website/astro.config.mjs
index 31175f9..d4b08b3 100644
--- a/website/astro.config.mjs
+++ b/website/astro.config.mjs
@@ -3,7 +3,7 @@ import starlight from '@astrojs/starlight';
// Docs site for @green-tea/core. Content lives in src/content/docs/**.
export default defineConfig({
- site: 'https://green-tea.dev',
+ site: 'https://docs.green-tea.dev',
integrations: [
starlight({
title: 'Green Tea.',
@@ -30,6 +30,7 @@ export default defineConfig({
{
label: 'Guides',
items: [
+ { label: 'The matcha CLI', slug: 'guides/cli' },
{ label: 'Routing', slug: 'guides/routing' },
{ label: 'Dependency injection', slug: 'guides/dependency-injection' },
{ label: 'Argument decorators', slug: 'guides/arguments' },
diff --git a/website/src/content/docs/getting-started.md b/website/src/content/docs/getting-started.md
index 70defac..a77e6bc 100644
--- a/website/src/content/docs/getting-started.md
+++ b/website/src/content/docs/getting-started.md
@@ -3,7 +3,16 @@ title: Getting started
description: Install green-tea, configure TypeScript decorators, and build your first graph-based route.
---
-## Install
+## Scaffold it
+
+The fastest path is [matcha](/guides/cli/), green-tea's CLI. It writes a project that runs on the first command — no wiring, no config:
+
+```bash
+matcha new my-api # --runtime node (default) | deno | bun
+cd my-api && matcha run
+```
+
+## Or install by hand
```bash
npm install @green-tea/core reflect-metadata
@@ -12,7 +21,9 @@ npm install ws # WebSocket routes (@Ws) and mesh
npm install busboy # multipart/form-data file uploads
```
-green-tea targets **Node ≥ 18** and uses **legacy** TypeScript decorators. Enable them in your `tsconfig.json`:
+green-tea runs on **Node ≥ 18, Deno, Bun, and the edge** — the same app, you only swap the entry point. This guide uses Node; see [runtimes](/guides/runtimes/) for the others and for what the edge can't offer.
+
+green-tea uses **legacy** TypeScript decorators. Enable them in your `tsconfig.json`:
```json
{
diff --git a/website/src/content/docs/guides/cli.md b/website/src/content/docs/guides/cli.md
new file mode 100644
index 0000000..aa6d768
--- /dev/null
+++ b/website/src/content/docs/guides/cli.md
@@ -0,0 +1,79 @@
+---
+title: The matcha CLI
+description: "Scaffold, run, and generate green-tea apps from a single native binary."
+---
+
+**matcha** scaffolds green-tea projects, runs them in watch mode, and generates pieces already wired into your graph. It is a native binary — installing the CLI needs no JS runtime, and it only reaches for yours when it runs or type-checks your project.
+
+That is deliberate: green-tea runs on Node, Deno, Bun, and the edge, so its tool shouldn't be bound to one of them.
+
+## Install
+
+```bash
+curl -fsSL https://raw.githubusercontent.com/Expressive-Tea/matcha/main/install.sh | sh
+```
+
+Downloads a checksum-verified prebuilt binary into `~/.local/bin`. Environment variables go on the `sh` side of the pipe:
+
+```bash
+curl -fsSL …/install.sh | MATCHA_VERSION=v26.7.0 MATCHA_INSTALL_DIR=/usr/local/bin sh
+```
+
+From source, if you have Rust:
+
+```bash
+cargo install --git https://github.com/Expressive-Tea/matcha
+```
+
+## Scaffold — `matcha new`
+
+```bash
+matcha new my-api # Node (the default)
+matcha new my-api --runtime deno # or deno | bun
+matcha new my-api --template-url gh:owner/repo # any git template
+```
+
+The starter is alive on the first run: it serves an `index.html` and streams a rotating zen message over `@Sse('/zen')`. Open the browser and something is already moving — you are editing a working app, not assembling one.
+
+Only the entry point and the config differ between runtimes. The `src/` tree is identical, which is the same portability the framework promises.
+
+## Run — `matcha run`
+
+```bash
+matcha run
+```
+
+Detects the runtime and starts a watch loop. First match wins:
+
+1. `matcha.toml` — an explicit `runtime = "node" | "deno" | "bun"`
+2. `deno.json` / `deno.jsonc` → deno
+3. `bun.lockb` / `bun.lock` → bun
+4. `package.json` → node
+
+Edge is a deploy target, not a `matcha run` target.
+
+## Generate — `matcha create`
+
+```bash
+matcha create controller Users
+matcha create step Authenticate
+matcha create provider Database
+matcha create module Billing
+matcha create controller Users --check # type-check with your runtime afterward
+```
+
+Writes the file **and wires it in** — into the right `@Module` array, or into `createApp({ modules })` for a module.
+
+## Extend — `matcha add`
+
+```bash
+matcha add sse # or: stream | buffer
+```
+
+Inserts a handler of that shape into your controller.
+
+## How the edits stay safe
+
+`create` and `add` edit your TypeScript with [tree-sitter](https://tree-sitter.github.io), not string splicing or regex. Edits are **idempotent** — running the same command twice doesn't duplicate anything — and they **revert themselves** if the result wouldn't parse. A generator that corrupts your source is worse than no generator.
+
+One case it deliberately refuses: if `modules` is a variable (`modules: MODULES`) rather than an array literal, `create module` won't add a second `modules` key. Duplicate keys parse cleanly, so nothing would fail — it would just silently shadow your value. It tells you instead.
diff --git a/website/src/content/docs/guides/streaming.md b/website/src/content/docs/guides/streaming.md
index 01ad3a7..f058931 100644
--- a/website/src/content/docs/guides/streaming.md
+++ b/website/src/content/docs/guides/streaming.md
@@ -7,18 +7,17 @@ Most stacks treat "push data over time" as a bolt-on: Express reaches for a `ws`
green-tea has one model: an **`AsyncIterable`**. A handler that returns a sequence of values over time *is* a stream — the same shape you'd return from any function. You **declare the mode** with a decorator; the framework handles framing, backpressure, cleanup, and disconnects.
-## One primitive, four modes
+## One primitive, three modes
| Declare | Direction | Transport | Reach for it when |
|---|---|---|---|
| `@Sse` | server → client | `text/event-stream` | live updates to a browser (`EventSource`) |
| `@Ws` | duplex | WebSocket | chat, collaboration — anything two-way |
| `@Stream` | negotiated | SSE / ndjson / WS, picked from the client's `Accept` / `Upgrade` | one handler, the client chooses |
-| *(plain return)* | server → client | SSE or ndjson by `Accept` | programmatic streaming over `fetch` |
The primitive never changes — it's always an `AsyncIterable`. What changes is **direction and framing**, and you declare which. That's the difference between each iterable green-tea hands you:
-- **`@Sse` / plain return** — you return **one** iterable: the *outbound* stream. Each `yield` becomes an SSE event, or an ndjson line.
+- **`@Sse`** — you return **one** iterable: the *outbound* stream. Each `yield` becomes an SSE event, or an ndjson line.
- **`@Ws` (duplex)** — **two** iterables. `@inbound()` gives you the client's *incoming* messages to consume; the one you **return** is the *outbound* stream to the client. `@abort()` hands you an `AbortSignal` for teardown.
- **`@Stream`** — you write the handler once; the client's request decides whether it arrives as SSE, ndjson, or a WebSocket. No branching in your code.
diff --git a/website/src/content/docs/index.mdx b/website/src/content/docs/index.mdx
index d725ccb..5e03bd4 100644
--- a/website/src/content/docs/index.mdx
+++ b/website/src/content/docs/index.mdx
@@ -37,6 +37,9 @@ Most frameworks make you keep the whole request in your head: which middleware r
Declare `@Sse`, `@Stream`, or `@Ws` and return an `AsyncIterable` — the transport streams it (SSE, ndjson, or a WebSocket duplex) with backpressure and cleanup handled. No separate gateway.
+
+ Node, Deno, Bun, and the edge — the same app, you only swap the entry point. HTTP, SSE, and WebSocket behave identically on all four.
+
:::note[Beta]
diff --git a/website/src/content/docs/reference/createapp.md b/website/src/content/docs/reference/createapp.md
index 9a78f67..7445393 100644
--- a/website/src/content/docs/reference/createapp.md
+++ b/website/src/content/docs/reference/createapp.md
@@ -53,7 +53,7 @@ const app = createApp(options);
### `MeshConfig`
-`{ secret?, teapots?, timeoutMs? }` — `teapots` is `{ url, secret }[]`. See [Mesh](/guides/mesh/).
+`{ secret?, teapots?, timeoutMs?, heartbeatMs? }` — `teapots` is `{ url, secret }[]`; `timeoutMs` bounds an RPC (default 30s, → 504), `heartbeatMs` is the ping gap that detects a half-open link (default 15s, → 503). See [Mesh](/guides/mesh/).
## The `App`