From 1fee7de5432a87c9272a430866908a7207ba2ebe Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Thu, 9 Jul 2026 14:37:12 -0500 Subject: [PATCH] docs: app.fetch runtimes guide (Node/Deno/Bun/edge) Signed-off-by: Diego Resendez --- website/astro.config.mjs | 1 + website/src/content/docs/guides/runtimes.md | 30 +++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 website/src/content/docs/guides/runtimes.md diff --git a/website/astro.config.mjs b/website/astro.config.mjs index ea69358..db488a6 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -41,6 +41,7 @@ export default defineConfig({ { label: 'Plugins & observability', slug: 'guides/plugins' }, { label: 'Graph introspection', slug: 'guides/introspection' }, { label: 'OpenAPI', slug: 'guides/openapi' }, + { label: 'Runtimes', slug: 'guides/runtimes' }, { label: 'Testing', slug: 'guides/testing' }, { label: 'Mesh (alpha)', slug: 'guides/mesh', badge: { text: 'alpha', variant: 'caution' } }, ], diff --git a/website/src/content/docs/guides/runtimes.md b/website/src/content/docs/guides/runtimes.md new file mode 100644 index 0000000..fae3a81 --- /dev/null +++ b/website/src/content/docs/guides/runtimes.md @@ -0,0 +1,30 @@ +--- +title: Runtimes (Node, Deno, Bun, edge) +description: "Run Green Tea anywhere with app.fetch — the Web-Standards handler." +--- + +Green Tea exposes a Web-Standards handler, `app.fetch(request): Promise`, so the +same app runs on any runtime that speaks the Fetch API — for **HTTP and SSE** today. + +```ts +const app = createApp({ modules: [ApiModule] }); + +// Node (native listener, TLS, timeouts) +app.listen(3000); + +// Deno +Deno.serve(app.fetch); + +// Bun +Bun.serve({ fetch: app.fetch }); + +// Cloudflare / edge +export default { fetch: app.fetch }; +``` + +**Node is the reference implementation** — every runtime returns the same status, headers, +and body for the same request (enforced by a parity test suite). + +**Not yet on non-Node runtimes:** WebSocket (`@Ws`) and mesh — Node-only for now; cross-runtime +WebSocket is on the roadmap. `app.listen()` and TLS are Node-only; on Deno/Bun/edge you get +`app.fetch`.