From 489aa685bb69ec66a0d04f80509ad620524db4cd Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 17 Jul 2026 10:13:10 -0500 Subject: [PATCH] docs: host the docs at green-tea.expressive-tea.io/docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The site hangs off the expressive-tea.io cPanel as green-tea.expressive-tea.io. A four-level docs.green-tea.expressive-tea.io subdomain reads badly and would need its own AutoSSL cert (the *.expressive-tea.io wildcard stops one level up). A /docs subfolder needs no extra host, DNS, or cert — it's a path — and is what most projects do. So the docs site now builds with base: '/docs' (its dist/ contents drop into the subdomain's docs/ folder in cPanel), the 77 hard-coded content links are prefixed, and the two hero actions Starlight doesn't rewrite are fixed by hand. Verified: /docs/ serves, / 404s, no unprefixed internal href remains. README points at the new docs URL. Signed-off-by: Diego Resendez --- README.md | 2 +- website/astro.config.mjs | 3 ++- website/src/content/docs/concepts/flow.md | 4 ++-- .../src/content/docs/concepts/the-graph.md | 6 ++--- website/src/content/docs/getting-started.md | 14 +++++------ website/src/content/docs/guides/arguments.md | 14 +++++------ .../docs/guides/dependency-injection.md | 12 +++++----- website/src/content/docs/guides/errors.md | 2 +- website/src/content/docs/guides/html.md | 4 ++-- .../src/content/docs/guides/introspection.md | 2 +- website/src/content/docs/guides/mesh.md | 2 +- website/src/content/docs/guides/openapi.md | 4 ++-- website/src/content/docs/guides/plugins.md | 4 ++-- website/src/content/docs/guides/routing.md | 4 ++-- website/src/content/docs/guides/runtimes.md | 8 +++---- website/src/content/docs/guides/security.md | 6 ++--- website/src/content/docs/guides/streaming.md | 4 ++-- website/src/content/docs/guides/testing.md | 2 +- website/src/content/docs/guides/uploads.md | 4 ++-- website/src/content/docs/guides/validation.md | 8 +++---- website/src/content/docs/index.mdx | 6 ++--- .../src/content/docs/reference/createapp.md | 24 +++++++++---------- .../src/content/docs/reference/decorators.md | 16 ++++++------- 23 files changed, 78 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 1342426..08d8010 100644 --- a/README.md +++ b/README.md @@ -230,7 +230,7 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h ## Docs & development -- **[docs.green-tea.dev](https://docs.green-tea.dev)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. +- **[green-tea.expressive-tea.io/docs](https://green-tea.expressive-tea.io/docs)** — getting started, concepts (the graph, `flow`), and guides: routing, DI, validation, uploads, streaming, HTML, security, errors, introspection, OpenAPI, plugins, mesh, runtimes, testing. - **[matcha](https://github.com/Expressive-Tea/matcha)** — the CLI. `matcha new` scaffolds a project (Node, Deno, or Bun), `matcha create` generates and auto-wires controllers/steps/providers/modules, `matcha run` detects your runtime and watches. A standalone Rust binary — no JS runtime needed to install it. ```bash diff --git a/website/astro.config.mjs b/website/astro.config.mjs index d4b08b3..8bcab26 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -3,7 +3,8 @@ import starlight from '@astrojs/starlight'; // Docs site for @green-tea/core. Content lives in src/content/docs/**. export default defineConfig({ - site: 'https://docs.green-tea.dev', + site: 'https://green-tea.expressive-tea.io', + base: '/docs', integrations: [ starlight({ title: 'Green Tea.', diff --git a/website/src/content/docs/concepts/flow.md b/website/src/content/docs/concepts/flow.md index 5f1b466..6348ed8 100644 --- a/website/src/content/docs/concepts/flow.md +++ b/website/src/content/docs/concepts/flow.md @@ -3,7 +3,7 @@ title: The typed flow core description: "The functional flow API where the compile-time dependency guarantee lives." --- -The [decorator layer](/guides/dependency-injection/) validates the graph at **boot**. The functional core, `flow`, validates it in the **type checker** — before the program ever runs. +The [decorator layer](/docs/guides/dependency-injection/) validates the graph at **boot**. The functional core, `flow`, validates it in the **type checker** — before the program ever runs. ```typescript import { flow } from '@green-tea/core'; @@ -21,4 +21,4 @@ This is the strongest guarantee green-tea offers: the type *is* the dependency c `npm run typecheck` in the repo includes a type-level test that asserts this accumulation behaves — a step that reads a missing key is expected to fail compilation. ::: -See [The dependency graph](/concepts/the-graph/) for how both layers describe the same model. +See [The dependency graph](/docs/concepts/the-graph/) for how both layers describe the same model. diff --git a/website/src/content/docs/concepts/the-graph.md b/website/src/content/docs/concepts/the-graph.md index 22c1bc7..c9aa75e 100644 --- a/website/src/content/docs/concepts/the-graph.md +++ b/website/src/content/docs/concepts/the-graph.md @@ -27,14 +27,14 @@ class Authenticate { /* ... */ } - **No ordering bugs.** There's no positional `app.use()` sequence to get wrong; the sort is the order. - **Each route runs only its slice.** A route runs the transitive closure of what its handler `@needs` (plus always-run observer steps) — an auth step doesn't run on a public route. - **Boot fails loudly.** If a handler needs a key nothing provides, `createApp` throws at boot with a "did you mean…?" hint — you never serve `undefined`. -- **You can read it.** `app.explain(route)` prints the ordered chain with origins; `app.graph()` / `GET /__graph__` render it as a diagram. See [Graph introspection](/guides/introspection/). +- **You can read it.** `app.explain(route)` prints the ordered chain with origins; `app.graph()` / `GET /__graph__` render it as a diagram. See [Graph introspection](/docs/guides/introspection/). ## Two layers green-tea exposes the graph two ways: -1. **The typed functional core, [`flow`](/concepts/flow/)** — the compile-time guarantee. A handler that reads `ctx.user` fails to **compile** if no step produces `user`. -2. **The declarative decorator layer** — `@Provider` / `@Step` / `@Module` / `@Route` / `@Get` plus [argument decorators](/guides/arguments/). Emits runtime metadata, builds and sorts the graph, and validates at boot. +1. **The typed functional core, [`flow`](/docs/concepts/flow/)** — the compile-time guarantee. A handler that reads `ctx.user` fails to **compile** if no step produces `user`. +2. **The declarative decorator layer** — `@Provider` / `@Step` / `@Module` / `@Route` / `@Get` plus [argument decorators](/docs/guides/arguments/). Emits runtime metadata, builds and sorts the graph, and validates at boot. Both describe the same graph; pick the ergonomics you want. diff --git a/website/src/content/docs/getting-started.md b/website/src/content/docs/getting-started.md index a77e6bc..9a9f4a3 100644 --- a/website/src/content/docs/getting-started.md +++ b/website/src/content/docs/getting-started.md @@ -5,7 +5,7 @@ description: Install green-tea, configure TypeScript decorators, and build your ## 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: +The fastest path is [matcha](/docs/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 @@ -21,7 +21,7 @@ npm install ws # WebSocket routes (@Ws) and mesh npm install busboy # multipart/form-data file uploads ``` -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 runs on **Node ≥ 18, Deno, Bun, and the edge** — the same app, you only swap the entry point. This guide uses Node; see [runtimes](/docs/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`: @@ -35,7 +35,7 @@ green-tea uses **legacy** TypeScript decorators. Enable them in your `tsconfig.j } ``` -You do **not** need `emitDecoratorMetadata` — green-tea records argument positions explicitly. See [Why legacy decorators](/concepts/the-graph/#why-legacy-decorators) for the rationale. +You do **not** need `emitDecoratorMetadata` — green-tea records argument positions explicitly. See [Why legacy decorators](/docs/concepts/the-graph/#why-legacy-decorators) for the rationale. ## Your first app @@ -89,7 +89,7 @@ The handler asked for `user` via `@needs('user')`. If nothing in the graph produ ## Where to next -- [The dependency graph](/concepts/the-graph/) — the mental model behind everything. -- [Dependency injection](/guides/dependency-injection/) — providers, steps, and modules in depth. -- [Argument decorators](/guides/arguments/) — everything a handler can inject. -- [Streaming & real-time](/guides/streaming/) — SSE, WebSocket, and ndjson from one primitive. +- [The dependency graph](/docs/concepts/the-graph/) — the mental model behind everything. +- [Dependency injection](/docs/guides/dependency-injection/) — providers, steps, and modules in depth. +- [Argument decorators](/docs/guides/arguments/) — everything a handler can inject. +- [Streaming & real-time](/docs/guides/streaming/) — SSE, WebSocket, and ndjson from one primitive. diff --git a/website/src/content/docs/guides/arguments.md b/website/src/content/docs/guides/arguments.md index 2ac8081..4f00175 100644 --- a/website/src/content/docs/guides/arguments.md +++ b/website/src/content/docs/guides/arguments.md @@ -34,7 +34,7 @@ getUser(@needs('user') user: any, @param('id') id: string) { } ``` -See [Dependency injection](/guides/dependency-injection/) for how `needs`/`provides` build the +See [Dependency injection](/docs/guides/dependency-injection/) for how `needs`/`provides` build the graph. ## `@ctx` — the whole context @@ -94,7 +94,7 @@ needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema) object. ::: -A failing schema short-circuits the request with **422**. See [Validation](/guides/validation/) +A failing schema short-circuits the request with **422**. See [Validation](/docs/guides/validation/) for the full contract (fail-fast order, error shape, async schemas, and caveats). ## Multipart access asymmetry @@ -138,11 +138,11 @@ echo(@inbound() incoming: AsyncIterable) { } ``` -See [Streaming](/guides/streaming/) for SSE, WebSocket duplex, and channels. +See [Streaming](/docs/guides/streaming/) for SSE, WebSocket duplex, and channels. ## Where to go next -- How injected values are produced: [Dependency injection](/guides/dependency-injection/). -- The mental model: [The graph](/concepts/the-graph/). -- Validating and coercing injected values: [Validation](/guides/validation/). -- The full API surface: [Decorator reference](/reference/decorators/). +- How injected values are produced: [Dependency injection](/docs/guides/dependency-injection/). +- The mental model: [The graph](/docs/concepts/the-graph/). +- Validating and coercing injected values: [Validation](/docs/guides/validation/). +- The full API surface: [Decorator reference](/docs/reference/decorators/). diff --git a/website/src/content/docs/guides/dependency-injection.md b/website/src/content/docs/guides/dependency-injection.md index 2026963..06dacaf 100644 --- a/website/src/content/docs/guides/dependency-injection.md +++ b/website/src/content/docs/guides/dependency-injection.md @@ -138,9 +138,9 @@ receive `undefined`. Boot fails loudly, so you never serve `undefined`. ## Where to go next -- New to green-tea? Start with [Getting started](/getting-started/). -- The mental model behind all of this: [The graph](/concepts/the-graph/). -- Everything a handler can inject: [Argument decorators](/guides/arguments/) and the - [decorator reference](/reference/decorators/). -- Coerce and validate injected values with Standard Schema: [Validation](/guides/validation/). -- Declare `@Sse` and return an `AsyncIterable` to push data over time: [Streaming](/guides/streaming/). +- New to green-tea? Start with [Getting started](/docs/getting-started/). +- The mental model behind all of this: [The graph](/docs/concepts/the-graph/). +- Everything a handler can inject: [Argument decorators](/docs/guides/arguments/) and the + [decorator reference](/docs/reference/decorators/). +- Coerce and validate injected values with Standard Schema: [Validation](/docs/guides/validation/). +- Declare `@Sse` and return an `AsyncIterable` to push data over time: [Streaming](/docs/guides/streaming/). diff --git a/website/src/content/docs/guides/errors.md b/website/src/content/docs/guides/errors.md index d239606..01e56c9 100644 --- a/website/src/content/docs/guides/errors.md +++ b/website/src/content/docs/guides/errors.md @@ -64,5 +64,5 @@ const app = createApp({ `onError` intercepts **every** HTTP error response — handler/step throws, a `404` for an unmatched route, `405`, a `413` (body too large), and a `400` (malformed body) — so your error surface is consistent across the whole app. Streaming and WebSocket errors are out of scope (they surface as an error frame or a WebSocket close code, not a response body). :::note -Errors are also observable without changing the response: subscribe to `request:step:error` (and `stream:error`) on [`app.bus`](/guides/plugins/) to log or trace them. +Errors are also observable without changing the response: subscribe to `request:step:error` (and `stream:error`) on [`app.bus`](/docs/guides/plugins/) to log or trace them. ::: diff --git a/website/src/content/docs/guides/html.md b/website/src/content/docs/guides/html.md index 246c83d..436e197 100644 --- a/website/src/content/docs/guides/html.md +++ b/website/src/content/docs/guides/html.md @@ -37,7 +37,7 @@ class AboutController { } ``` -Reading a file needs a filesystem, so this mode is Node/Deno/Bun only — see [Runtimes](/guides/runtimes/) for the edge alternative. +Reading a file needs a filesystem, so this mode is Node/Deno/Bun only — see [Runtimes](/docs/guides/runtimes/) for the edge alternative. ### 3. Render a template — Node/Deno/Bun @@ -134,7 +134,7 @@ const app3 = createApp({ modules: [ApiModule], static: '/srv/site' }); // absolu - **Declared routes always win.** Static is only consulted when nothing matched, so `@Get('/api/ping')` is never shadowed by a file at `public/api/ping`. - Path traversal (`../`, encoded or not) is rejected — a request can't escape the static root. -Like the file/template modes of `@Html`, `static` needs a filesystem: it's Node/Deno/Bun only. Configuring it on an edge runtime throws at `createApp()` time — see [Runtimes](/guides/runtimes/). +Like the file/template modes of `@Html`, `static` needs a filesystem: it's Node/Deno/Bun only. Configuring it on an edge runtime throws at `createApp()` time — see [Runtimes](/docs/guides/runtimes/). ## The boot rule diff --git a/website/src/content/docs/guides/introspection.md b/website/src/content/docs/guides/introspection.md index ebda170..3f50cbc 100644 --- a/website/src/content/docs/guides/introspection.md +++ b/website/src/content/docs/guides/introspection.md @@ -3,7 +3,7 @@ title: Graph introspection description: "explain, graph, toMermaid, and the graph endpoint." --- -Because the request/boot pipeline is an explicit [dependency graph](/concepts/the-graph/), +Because the request/boot pipeline is an explicit [dependency graph](/docs/concepts/the-graph/), you can inspect it directly — visualize the whole thing, or explain exactly which nodes a single route runs. diff --git a/website/src/content/docs/guides/mesh.md b/website/src/content/docs/guides/mesh.md index e46c97a..d062a31 100644 --- a/website/src/content/docs/guides/mesh.md +++ b/website/src/content/docs/guides/mesh.md @@ -7,7 +7,7 @@ description: "Distributed dependency injection over a secret-gated WebSocket con Mesh is **alpha** — its API and wire protocol may change between releases, and discovery, load-balancing, and failover are not built. It is gated behind an explicit opt-in: `createApp({ mesh, experimental: true })`, and `createApp` **throws** if you configure `mesh` without `experimental: true`. **Don't ship mesh to production yet.** ::: -A **teacup** can depend on a token that physically lives on another node — a **teapot**. `@needs('billing')` resolves the same whether `billing` runs in this process or on a remote one. There's no gRPC layer or message-pattern DSL: there's the [graph](/concepts/the-graph/), and some nodes happen to live elsewhere. +A **teacup** can depend on a token that physically lives on another node — a **teapot**. `@needs('billing')` resolves the same whether `billing` runs in this process or on a remote one. There's no gRPC layer or message-pattern DSL: there's the [graph](/docs/concepts/the-graph/), and some nodes happen to live elsewhere. Exports are opt-in (`export: true`) and the control channel is gated by a shared secret. diff --git a/website/src/content/docs/guides/openapi.md b/website/src/content/docs/guides/openapi.md index cabb51c..7970702 100644 --- a/website/src/content/docs/guides/openapi.md +++ b/website/src/content/docs/guides/openapi.md @@ -3,7 +3,7 @@ title: OpenAPI description: "Generate a structural OpenAPI 3.1 document from the route graph." --- -Because the request pipeline is [data you can read](/concepts/the-graph/), green-tea can project it — the same way it renders [Mermaid/DOT](/guides/introspection/), it emits **OpenAPI**. +Because the request pipeline is [data you can read](/docs/concepts/the-graph/), green-tea can project it — the same way it renders [Mermaid/DOT](/docs/guides/introspection/), it emits **OpenAPI**. ## `app.openapi()` @@ -36,6 +36,6 @@ const app = createApp({ modules: [ApiModule], devOpenapi: true }); This is a **structural** spec: paths, methods, parameters, which routes take a body, and the standard error responses. What it does **not** include yet: -- **Request/response body schemas.** [Standard Schema](/guides/validation/) (zod/valibot/arktype) validates input but does not expose a JSON Schema representation, so body shapes are documented generically. Parameter types default to `string`. +- **Request/response body schemas.** [Standard Schema](/docs/guides/validation/) (zod/valibot/arktype) validates input but does not expose a JSON Schema representation, so body shapes are documented generically. Parameter types default to `string`. Full schemas — declared and enforced on the way out via a `@Produce(schema)` decorator that also validates responses — are on the roadmap for the stable release. For beta, the structural document already drives Swagger UI, client codegen, and API diffing. diff --git a/website/src/content/docs/guides/plugins.md b/website/src/content/docs/guides/plugins.md index d6d7a89..0047ede 100644 --- a/website/src/content/docs/guides/plugins.md +++ b/website/src/content/docs/guides/plugins.md @@ -30,7 +30,7 @@ and the framework computes where that node lands. Because execution is per-route (a route runs only the transitive closure of its handler's `@needs`), a plugin step that should run on **every** route must produce nothing — add it with `provides: []`. A step that produces no token has nothing to gate on, so the framework -runs it unconditionally. See [The graph](/concepts/the-graph/) for how the closure is +runs it unconditionally. See [The graph](/docs/concepts/the-graph/) for how the closure is computed. ::: @@ -55,4 +55,4 @@ The full event vocabulary: Observation is read-only: handlers see the event payload but can't alter control flow. To change behavior, contribute a node to your scope — see -[Dependency injection](/guides/dependency-injection/). +[Dependency injection](/docs/guides/dependency-injection/). diff --git a/website/src/content/docs/guides/routing.md b/website/src/content/docs/guides/routing.md index ea4145f..50161f3 100644 --- a/website/src/content/docs/guides/routing.md +++ b/website/src/content/docs/guides/routing.md @@ -51,7 +51,7 @@ When more than one route matches the same path, the **most specific wins** — ` A path that no route matches returns `404`. A path that **does** exist but under a different method returns **`405 Method Not Allowed`** with an `Allow` header listing the methods that do match — not a `404`. :::note -A bare `OPTIONS` request (without an `Access-Control-Request-Method` header — i.e. not a CORS preflight) to an existing path therefore returns `405` with `Allow`. CORS preflights are handled separately; see [Transport security](/guides/security/). +A bare `OPTIONS` request (without an `Access-Control-Request-Method` header — i.e. not a CORS preflight) to an existing path therefore returns `405` with `Allow`. CORS preflights are handled separately; see [Transport security](/docs/guides/security/). ::: ## Not yet @@ -61,4 +61,4 @@ The matcher is intentionally small for beta. **Not built** (on the roadmap): - Regex / typed param constraints such as `:id(\d+)`. - Route matching is a **linear scan** — fine for typical route tables, but a radix-tree matcher for very large ones isn't implemented. -See [Streaming & real-time](/guides/streaming/) for `@Sse` / `@Ws` / `@Stream`, and [Argument decorators](/guides/arguments/) for everything a handler can read from a request. +See [Streaming & real-time](/docs/guides/streaming/) for `@Sse` / `@Ws` / `@Stream`, and [Argument decorators](/docs/guides/arguments/) for everything a handler can read from a request. diff --git a/website/src/content/docs/guides/runtimes.md b/website/src/content/docs/guides/runtimes.md index 6ce091e..946cf31 100644 --- a/website/src/content/docs/guides/runtimes.md +++ b/website/src/content/docs/guides/runtimes.md @@ -60,7 +60,7 @@ Any runtime can build a `WsSocket` capability (`inbound`, `abort`, `isOpen`, `se same primitive (see below). **Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Deno you get -`app.fetch` + `serveDeno`. [Mesh](/guides/mesh/) works here: the control channel is +`app.fetch` + `serveDeno`. [Mesh](/docs/guides/mesh/) works here: the control channel is served through `app.upgrade` and the teacup connects with Deno's global `WebSocket`. ## WebSocket on Bun @@ -83,7 +83,7 @@ serveBun(app, { port: 8000 }); run on Node and Deno. Behaviour matches the Node reference. **Still Node-only:** `app.listen()`, TLS and per-request timeouts. On Bun you get -`app.fetch` + `serveBun`. [Mesh](/guides/mesh/) works here too. +`app.fetch` + `serveBun`. [Mesh](/docs/guides/mesh/) works here too. ## Cloudflare Workers / edge @@ -115,7 +115,7 @@ compatibility_date = "2024-09-23" # or later Green Tea's core statically imports Node built-ins that workerd only provides under this flag; without it, the Worker fails to load. -**Still Node-only:** `app.listen()`, TLS and per-request timeouts. [Mesh](/guides/mesh/) +**Still Node-only:** `app.listen()`, TLS and per-request timeouts. [Mesh](/docs/guides/mesh/) is **not** supported on edge: the teapot's secret comparison needs `node:crypto`'s `timingSafeEqual`, which `nodejs_compat` does not provide. Cloudflare's Durable Objects and WebSocket Hibernation are **not** used — `edgeHandler` accepts @@ -124,7 +124,7 @@ open for its lifetime rather than hibernating between messages. ## Filesystem features — Node/Deno/Bun only -A few [HTML & views](/guides/html/) features read from disk, so they need a runtime with +A few [HTML & views](/docs/guides/html/) features read from disk, so they need a runtime with a filesystem: - `@Html('file.html')` — reads and caches the file at boot. diff --git a/website/src/content/docs/guides/security.md b/website/src/content/docs/guides/security.md index a883a57..31971e0 100644 --- a/website/src/content/docs/guides/security.md +++ b/website/src/content/docs/guides/security.md @@ -4,7 +4,7 @@ description: "TLS and wss, secure-by-default headers, CORS, and trustProxy." --- Four `createApp` options cover TLS, proxying, CORS, and response headers: `tls`, -`trustProxy`, `cors`, and `security`. See the [`createApp` reference](/reference/createapp/) +`trustProxy`, `cors`, and `security`. See the [`createApp` reference](/docs/reference/createapp/) for the full option list. ## TLS (native https/wss) @@ -97,5 +97,5 @@ strips and sets forwarded headers itself, and terminate TLS where you control th ## Related -- [`createApp` reference](/reference/createapp/) — every construction option -- [File uploads / multipart](/guides/uploads/) — request-body handling +- [`createApp` reference](/docs/reference/createapp/) — every construction option +- [File uploads / multipart](/docs/guides/uploads/) — request-body handling diff --git a/website/src/content/docs/guides/streaming.md b/website/src/content/docs/guides/streaming.md index f058931..25fbcfb 100644 --- a/website/src/content/docs/guides/streaming.md +++ b/website/src/content/docs/guides/streaming.md @@ -22,7 +22,7 @@ The primitive never changes — it's always an `AsyncIterable`. What changes is - **`@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. :::note -Streaming bypasses the response transformer — the transport frames each value directly, handles backpressure, and cleans up on disconnect. See [arguments](/guides/arguments/) for the full list of argument decorators, including the stream-only `@inbound()` and `@abort()`. +Streaming bypasses the response transformer — the transport frames each value directly, handles backpressure, and cleans up on disconnect. See [arguments](/docs/guides/arguments/) for the full list of argument decorators, including the stream-only `@inbound()` and `@abort()`. ::: ## Streaming — SSE @@ -101,7 +101,7 @@ class Live { Same `@Route`, same handler shape, same `AsyncIterable` — real-time is not a separate framework you also have to learn. -`rooms` is the built-in shared `Rooms` primitive (one instance app-wide). A typical chat handler pumps the `@inbound()` channel into `rooms.room(name)` and returns that same room as its outbound channel, so every joined socket multicasts to the others. A handshake `@Step` can read `?token=` and throw `Unauthorized` — which closes the socket with code **4401** (`4000 + status`). See [security](/guides/security/) for handshake authentication. +`rooms` is the built-in shared `Rooms` primitive (one instance app-wide). A typical chat handler pumps the `@inbound()` channel into `rooms.room(name)` and returns that same room as its outbound channel, so every joined socket multicasts to the others. A handshake `@Step` can read `?token=` and throw `Unauthorized` — which closes the socket with code **4401** (`4000 + status`). See [security](/docs/guides/security/) for handshake authentication. ## Transport is declared, not inferred diff --git a/website/src/content/docs/guides/testing.md b/website/src/content/docs/guides/testing.md index 709e5aa..b9ff592 100644 --- a/website/src/content/docs/guides/testing.md +++ b/website/src/content/docs/guides/testing.md @@ -29,5 +29,5 @@ An override for an unknown token throws. The set of tokens is validated against graph, so a typo'd or stale override is a construction-time error, not a silent no-op. ::: -This pairs well with [`app.explain(route)`](/guides/introspection/) — explain the chain to +This pairs well with [`app.explain(route)`](/docs/guides/introspection/) — explain the chain to see which tokens a route actually depends on, then override exactly those. diff --git a/website/src/content/docs/guides/uploads.md b/website/src/content/docs/guides/uploads.md index 0162ee9..e0275af 100644 --- a/website/src/content/docs/guides/uploads.md +++ b/website/src/content/docs/guides/uploads.md @@ -27,7 +27,7 @@ class ProfileController { `UploadedFile` is `{ filename, contentType, data: Buffer, size }` — the whole file is buffered in memory, no temp files. :::note[Access asymmetry] -For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use `@body()` and read `.fields`/`.files`, or key into the envelope itself with `@body('fields')` / `@body('files')`. See [arguments](/guides/arguments/) for how `@body()` behaves across content types. +For multipart, `@body('title')` returns `undefined` — the value lives at `body.fields.title`, not `body.title`, unlike JSON/urlencoded where `@body('title')` picks the value directly. Use `@body()` and read `.fields`/`.files`, or key into the envelope itself with `@body('fields')` / `@body('files')`. See [arguments](/docs/guides/arguments/) for how `@body()` behaves across content types. ::: ## Repeated fields — `bodyDuplicates` @@ -67,5 +67,5 @@ uploadAvatar(@body() form: MultipartBody) { /* ... */ } A route's `maxBodyBytes` / `maxParts` fall back to the server-wide `limits` when unset. A malformed multipart body (bad boundary, missing headers, truncated part) → **400**. :::note -To validate parsed fields against a schema, pass a Standard Schema to `@body()` — see [validation](/guides/validation/). +To validate parsed fields against a schema, pass a Standard Schema to `@body()` — see [validation](/docs/guides/validation/). ::: diff --git a/website/src/content/docs/guides/validation.md b/website/src/content/docs/guides/validation.md index 1927e36..ce735c8 100644 --- a/website/src/content/docs/guides/validation.md +++ b/website/src/content/docs/guides/validation.md @@ -48,7 +48,7 @@ needs a name to say which route param it binds. `@body(Schema)`, `@query(Schema) object (all of `body`/`query`/`headers`). ::: -See [Argument decorators](/guides/arguments/) for the full slot semantics of each decorator. +See [Argument decorators](/docs/guides/arguments/) for the full slot semantics of each decorator. ## Failure: 422 with per-field issues @@ -79,6 +79,6 @@ validation are all out of scope for this feature. ## Related -- [Argument decorators](/guides/arguments/) — every slot decorator and its parsing rules -- [File uploads / multipart](/guides/uploads/) — how multipart bodies are parsed before validation -- [`createApp` reference](/reference/createapp/) — app construction options +- [Argument decorators](/docs/guides/arguments/) — every slot decorator and its parsing rules +- [File uploads / multipart](/docs/guides/uploads/) — how multipart bodies are parsed before validation +- [`createApp` reference](/docs/reference/createapp/) — app construction options diff --git a/website/src/content/docs/index.mdx b/website/src/content/docs/index.mdx index 5e03bd4..b774c65 100644 --- a/website/src/content/docs/index.mdx +++ b/website/src/content/docs/index.mdx @@ -9,11 +9,11 @@ hero: tagline: A zen, opinionated, type-safe framework. Your API is a dependency graph you can see, slice, and trust — not a mutable bag threaded through positional middleware. That's the tea. 🍵 actions: - text: Get started - link: /getting-started/ + link: /docs/getting-started/ icon: right-arrow variant: primary - text: The idea - link: /concepts/the-graph/ + link: /docs/concepts/the-graph/ icon: open-book variant: minimal --- @@ -43,5 +43,5 @@ Most frameworks make you keep the whole request in your head: which middleware r :::note[Beta] -green-tea is **beta**, on the RC track. One runtime dependency (`reflect-metadata`); `ws` and `busboy` are optional peers. [mesh](/guides/mesh/) is alpha and gated behind an explicit opt-in. +green-tea is **beta**, on the RC track. One runtime dependency (`reflect-metadata`); `ws` and `busboy` are optional peers. [mesh](/docs/guides/mesh/) is alpha and gated behind an explicit opt-in. ::: diff --git a/website/src/content/docs/reference/createapp.md b/website/src/content/docs/reference/createapp.md index 7445393..429715e 100644 --- a/website/src/content/docs/reference/createapp.md +++ b/website/src/content/docs/reference/createapp.md @@ -12,21 +12,21 @@ const app = createApp(options); | Option | Type | Default | Meaning | |---|---|---|---| | `modules` | `Ctor[]` | — | the `@Module` classes to wire (required) | -| `plugins` | `Plugin[]` | `[]` | plugins, each limited to `bus.on` + `scope.add` ([plugins](/guides/plugins/)) | +| `plugins` | `Plugin[]` | `[]` | plugins, each limited to `bus.on` + `scope.add` ([plugins](/docs/guides/plugins/)) | | `limits` | `RequestLimits` | see below | body-size and timeout ceilings | -| `devGraph` | `boolean` | `false` | mount `GET /__graph__` ([introspection](/guides/introspection/)) | -| `devOpenapi` | `boolean` | `false` | mount `GET /__openapi__` serving the [OpenAPI](/guides/openapi/) document | -| `overrides` | `Record` | — | swap any node by token ([testing](/guides/testing/)) | +| `devGraph` | `boolean` | `false` | mount `GET /__graph__` ([introspection](/docs/guides/introspection/)) | +| `devOpenapi` | `boolean` | `false` | mount `GET /__openapi__` serving the [OpenAPI](/docs/guides/openapi/) document | +| `overrides` | `Record` | — | swap any node by token ([testing](/docs/guides/testing/)) | | `tls` | `TlsOptions` | — | serve over https/wss | | `trustProxy` | `boolean` | `false` | honor `X-Forwarded-*` for `ctx.protocol` / `ctx.ip` | -| `security` | `boolean \| SecurityOptions` | `true` | secure-by-default headers ([security](/guides/security/)) | +| `security` | `boolean \| SecurityOptions` | `true` | secure-by-default headers ([security](/docs/guides/security/)) | | `cors` | `CorsOptions` | — | CORS handling | | `bodyDuplicates` | `'array' \| 'last'` | `'last'` | policy for repeated form fields | -| `onError` | `ErrorRenderer` | — | render errors your way ([error handling](/guides/errors/)); returns a response or `undefined` to fall back to JSON | -| `views` | `string` | `process.cwd()` | base dir `@Html('file.html')` paths resolve against — relative paths join it, absolute paths are used as-is ([HTML & views](/guides/html/)) | -| `viewEngine` | `(source: string, data: unknown) => string` | built-in `render` | swap in your own template engine for `@Html(..., { template: true })`; template mode only ([HTML & views](/guides/html/)) | -| `static` | `boolean \| string` | — | serve a directory as a `GET`/`HEAD` fallback (after declared routes, before `404`); `true` → `./public`, a string → that dir; path-traversal-safe; needs a filesystem — Node/Deno/Bun only ([HTML & views](/guides/html/)) | -| `mesh` | `MeshConfig` | — | distributed DI — **requires `experimental: true`** ([mesh](/guides/mesh/)) | +| `onError` | `ErrorRenderer` | — | render errors your way ([error handling](/docs/guides/errors/)); returns a response or `undefined` to fall back to JSON | +| `views` | `string` | `process.cwd()` | base dir `@Html('file.html')` paths resolve against — relative paths join it, absolute paths are used as-is ([HTML & views](/docs/guides/html/)) | +| `viewEngine` | `(source: string, data: unknown) => string` | built-in `render` | swap in your own template engine for `@Html(..., { template: true })`; template mode only ([HTML & views](/docs/guides/html/)) | +| `static` | `boolean \| string` | — | serve a directory as a `GET`/`HEAD` fallback (after declared routes, before `404`); `true` → `./public`, a string → that dir; path-traversal-safe; needs a filesystem — Node/Deno/Bun only ([HTML & views](/docs/guides/html/)) | +| `mesh` | `MeshConfig` | — | distributed DI — **requires `experimental: true`** ([mesh](/docs/guides/mesh/)) | | `experimental` | `boolean` | `false` | opt in to alpha features (currently gates `mesh`) | ### `RequestLimits` @@ -53,7 +53,7 @@ const app = createApp(options); ### `MeshConfig` -`{ 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/). +`{ 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](/docs/guides/mesh/). ## The `App` @@ -67,7 +67,7 @@ const app = createApp(options); | `explain(route)` | `Explain` | the chain annotated with each node's needs/provides | | `graph()` | `GraphView` | the full node + route graph | | `toMermaid()` / `toDOT()` | `string` | render the graph | -| `openapi(info?)` | `OpenApiDoc` | structural OpenAPI 3.1 document ([details](/guides/openapi/)) | +| `openapi(info?)` | `OpenApiDoc` | structural OpenAPI 3.1 document ([details](/docs/guides/openapi/)) | | `degraded()` | `string[]` | optional providers running degraded (empty until `listen()`) | | `bus` | `Bus` | lifecycle + request event bus | diff --git a/website/src/content/docs/reference/decorators.md b/website/src/content/docs/reference/decorators.md index c3233a5..e51ed87 100644 --- a/website/src/content/docs/reference/decorators.md +++ b/website/src/content/docs/reference/decorators.md @@ -3,7 +3,7 @@ title: Decorators description: "Full reference for every class, method, and argument decorator." --- -Every decorator green-tea exports, grouped by where it applies. All require `experimentalDecorators: true` in your `tsconfig` — see [Why legacy decorators](/concepts/the-graph/#why-legacy-decorators). +Every decorator green-tea exports, grouped by where it applies. All require `experimentalDecorators: true` in your `tsconfig` — see [Why legacy decorators](/docs/concepts/the-graph/#why-legacy-decorators). ## Structure @@ -35,8 +35,8 @@ An app-scope value, built once at boot and cached, addressable by `provides`. |---|---|---|---| | `provides` | `string` | — | the token this provider produces (required) | | `needs` | `string[]` | `[]` | tokens it depends on | -| `optional` | `boolean` | `false` | if it throws on boot, degrade instead of aborting ([details](/guides/dependency-injection/)) | -| `export` | `boolean` | `false` | expose over the mesh control channel ([mesh](/guides/mesh/)) | +| `optional` | `boolean` | `false` | if it throws on boot, degrade instead of aborting ([details](/docs/guides/dependency-injection/)) | +| `export` | `boolean` | `false` | expose over the mesh control channel ([mesh](/docs/guides/mesh/)) | ### `@Step(options)` @@ -48,19 +48,19 @@ Method decorator. Turns a handler's return value into `{ status?, headers?, body ### `@Html` / `@Html(path, opts?)` -Method decorator. Marks a buffered `GET`/`POST` handler as serving HTML instead of going through the JSON transformer. Three modes ([details](/guides/html/)): +Method decorator. Marks a buffered `GET`/`POST` handler as serving HTML instead of going through the JSON transformer. Three modes ([details](/docs/guides/html/)): | Form | Behavior | |---|---| | `@Html` (bare) | sends the handler's returned string as `text/html` | | `@Html('file.html')` | serves that file verbatim; the handler's return value is ignored | -| `@Html('file.html', { template: true })` | renders the file with the handler's returned data, via the built-in `render` engine or `viewEngine` ([createApp](/reference/createapp/)) | +| `@Html('file.html', { template: true })` | renders the file with the handler's returned data, via the built-in `render` engine or `viewEngine` ([createApp](/docs/reference/createapp/)) | Only buffered `GET`/`POST` routes are supported, and `@Html` can't be combined with `@Transformer` on the same handler — both are validated at boot, not per-request. ## Routes -Method decorators on a controller. All accept `(path, opts?)` where `opts = { export?: boolean, duplicates?: 'array' | 'last', maxBodyBytes?: number, maxParts?: number }`. `maxBodyBytes` / `maxParts` override the server-wide [`limits`](/reference/createapp/) for this route only. +Method decorators on a controller. All accept `(path, opts?)` where `opts = { export?: boolean, duplicates?: 'array' | 'last', maxBodyBytes?: number, maxParts?: number }`. `maxBodyBytes` / `maxParts` override the server-wide [`limits`](/docs/reference/createapp/) for this route only. | Decorator | Method | Transport | |---|---|---| @@ -75,7 +75,7 @@ Method decorators on a controller. All accept `(path, opts?)` where `opts = { ex @Post('/avatar', { maxBodyBytes: 5_000_000, maxParts: 20 }) // per-route upload limits ``` -See [Routing](/guides/routing/) for pattern matching and [Streaming](/guides/streaming/) for the transports. +See [Routing](/docs/guides/routing/) for pattern matching and [Streaming](/docs/guides/streaming/) for the transports. ## Arguments @@ -93,4 +93,4 @@ A handler's signature declares exactly what it wants, in any order. | `@inbound()` | the incoming message stream (WebSocket) | `()` | | `@abort()` | the request's `AbortSignal` | `()` | -Passing a [Standard Schema](/guides/validation/) validates and coerces the value before the handler sees it. Full details in [Argument decorators](/guides/arguments/). +Passing a [Standard Schema](/docs/guides/validation/) validates and coerces the value before the handler sees it. Full details in [Argument decorators](/docs/guides/arguments/).