From 0ad53fa2848ffc5e1c91d5edd6d81b3eff4f7143 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 7 Aug 2026 14:03:37 -0500 Subject: [PATCH 1/4] docs: lead with the problem, document limits, declare the observability gap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The README opened with identity and an install block; the pain that motivates the graph only appeared after a scroll. Move it up: `req.user` first, then the idea, then how to install it. Three fixes while in here: - The install line now pins `@beta`. `latest` and `beta` both point at the newest beta until a stable ships, and the versioning note said the opposite. - Document `RequestLimits`. Body caps, multipart parts and the request / headers / keep-alive timeouts were already applied with defaults tighter than Node's, and nothing in the README said so. - Honest scope now admits there is no observability layer — no logger, no metrics, no tracing hooks — and points at the issue tracking it as one design. It is the gap a team hits in week one of a real evaluation. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9e0e902..fa99449 100644 --- a/README.md +++ b/README.md @@ -11,25 +11,40 @@ not a mutable bag threaded through positional middleware. That's the tea. 🍵

-`@green-tea/core` — **beta**, RC-track. One runtime dependency: `reflect-metadata`. Two optional peers you install only if you use them: `ws` (WebSocket / mesh) and `busboy` (multipart uploads). +--- -```bash -npm install @green-tea/core reflect-metadata -# optional, only if you use them: -npm install ws # WebSocket routes (@Ws) and mesh -npm install busboy # multipart/form-data file uploads +## The problem + +```js +const user = req.user; ``` ---- +It compiles. TypeScript is happy. And it's a prayer — `req.user` exists only if some middleware ran before this handler, which depends on where the router got mounted, which line `app.use()` sits on, and whether a package you installed last sprint quietly inserted itself into the middle of your chain. + +So you keep the whole request in your head: what ran, what's on `req` by now, what order things fire in, which plugin deleted your body parser. That bookkeeping is where the bugs live, and no test or type catches them, because nothing is *wrong* — the code is correct and the app is still broken. ## The idea -Most frameworks make you keep the whole request in your head: which middleware ran, whether `req.user` exists by now, what order things fire in, which plugin quietly deleted your body parser. That mental bookkeeping is where bugs live. +green-tea puts the request on the page instead. You declare what each step **needs** and **produces**; the framework computes the order, type-checks the wiring, and can print the whole thing. -green-tea puts the request on the page instead. You declare what each step **needs** and **produces**; the framework computes the order, type-checks the wiring, and can print the whole thing. A route runs only the steps its handler actually depends on. Boot fails loudly when a dependency is missing, so you never serve `undefined`. +- Order is **derived** from your dependencies, never maintained by hand. +- Boot **fails loudly** when nothing provides a key, so you never serve `undefined`. +- A route runs **only** the steps its handler actually depends on. +- `app.explain('/users/:id')` prints the whole chain. Onboarding is reading, not archaeology. Less to hold in your head. That's the tea. +```bash +npm install @green-tea/core@beta reflect-metadata +``` + +`@green-tea/core` — **beta**, RC-track. One runtime dependency: `reflect-metadata`. Two optional peers you install only if you use them: + +```bash +npm install ws # WebSocket routes (@Ws) and mesh +npm install busboy # multipart/form-data file uploads +``` + ## What's different — and why it matters - **The pipeline is a graph, not a chain.** You never write "put this before that." You declare `needs`/`provides` and green-tea topologically sorts it. *Why it matters:* no ordering bugs, no positional guesswork, and each route runs only its slice of the graph (an auth step doesn't run on public routes). @@ -94,6 +109,7 @@ Beta shipped the parts a real API needs, without growing the runtime dependency - **Real body parsing.** JSON and urlencoded out of the box; `multipart/form-data` file uploads (`@body()` → `{ fields, files }`) via the optional [`busboy`](https://github.com/mscdex/busboy) peer dependency (`npm i busboy`) — a multipart request without it returns a clear `501`. All size-capped (`413`) against DoS. - **Errors, your way.** Throw typed errors (`Unauthorized`, `NotFound`, `HttpError(status, msg, body?)`) anywhere; they convert centrally to `4xx`/`5xx`. Render them however you like — HTML, RFC 7807, content-negotiated — with a single `createApp({ onError })` hook that covers every error response. - **HTML without a view layer.** `@Html` returns a string, serves a file, or renders one with the built-in `{{ }}` template engine — swap in EJS or handlebars with `createApp({ viewEngine })`. `createApp({ static: true })` serves `./public` with path-traversal guards and no mime dependency. +- **Ceilings that are already on.** `limits` caps body size (`413`), multipart parts, and the request / headers / keep-alive timeouts — defaulting to `30s` / `10s` / `5s`, tighter than Node's own two-minute default. Configurable, and safe before you configure anything. - **Graceful shutdown.** `app.close()` drains in-flight requests, closes live streams and mesh links. - **Testable by construction.** `createApp({ overrides: { db: fakeDb } })` swaps any node in one line. - **Dual ESM + CommonJS.** Ships both builds behind an `exports` map — `import` and `require` both resolve, with matching type declarations. @@ -227,6 +243,8 @@ green-tea is **beta**, on the road to a release candidate. Express and Fastify h **Bring your own auth (and friends).** green-tea ships transport security — TLS/wss, secure-by-default headers, CORS — but **not** authentication, authorization, rate-limiting, CSRF, or sessions. You compose those as steps and plugins (the `Authenticate` step in the quick look is the pattern). Unlike Express/Fastify, there is no off-the-shelf plugin ecosystem for them yet. +**No observability layer, either.** There is no built-in logger, no metrics export, and no tracing hooks; core does not depend on a logging library and does not intend to. Today you compose those as steps and providers like anything else. A first-class contract — an injectable logger, structured output, and hooks an OpenTelemetry exporter can attach to — is [tracked as one design](https://github.com/Expressive-Tea/green-tea/issues/10), because doing it piecemeal produces three mechanisms that don't fit together. If your team's definition of production-ready includes shipping traces on day one, this is the gap to know about. + **Runtimes differ in what they can offer.** Node ≥ 18, Deno, and Bun run everything. On the edge (Cloudflare Workers) there is no `app.listen()`, no filesystem — so `@Html` file/template modes and `static` serving are unavailable — and mesh does not run there at all (the teapot's secret comparison needs `node:crypto`'s `timingSafeEqual`, which `nodejs_compat` doesn't provide). Workers also require the `nodejs_compat` flag. **mesh is alpha.** Distributed DI works, but discovery, load-balancing, and failover are not built, and its API and wire protocol may change between releases. It is gated behind an explicit opt-in — `createApp({ mesh, experimental: true })` — and `createApp` throws if you configure `mesh` without it. Don't ship mesh to production yet. @@ -261,7 +279,7 @@ npm run docs:dev # the documentation site (website/) green-tea uses **calendar versioning**: `YY.M.PATCH` (e.g. `26.8.0` = the first release cut in August 2026, patch 0). The month is **not** zero-padded — npm treats versions as semver, which forbids leading zeros. A version tells you *when* it shipped, not how many breaking changes preceded it — those are always called out in the [CHANGELOG](./CHANGELOG.md). -**While in beta**, releases carry a `-beta.N` pre-release suffix on the calendar version (e.g. `26.8.0-beta.0`) and publish under the npm `beta` dist-tag — so a plain `npm install @green-tea/core` won't pick one up until the first stable calendar release. The API can still change between betas. +**While in beta**, releases carry a `-beta.N` pre-release suffix on the calendar version (e.g. `26.8.0-beta.0`) and publish under the npm `beta` dist-tag. Until the first stable release there is nothing else to install, so `latest` tracks the newest beta too — `npm install @green-tea/core` and `@green-tea/core@beta` resolve to the same version. Install with the explicit `@beta` tag anyway: the day a stable ships, `latest` moves to it and your installs stay on the channel you meant. The API can still change between betas. ## License -- 2.54.1 From 27f1d103ead77fa52f32d6d01b38faa9619e21fc Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 7 Aug 2026 14:03:39 -0500 Subject: [PATCH 2/4] docs(website): add privacy-friendly analytics to the docs site GoatCounter via Starlight's `head` option, same site code as the marketing site so /docs traffic lands in one dashboard and referrer paths stay comparable. No cookies, no personal data, no consent banner, nothing to host. Answers the one question we cannot answer today: do the articles convert into documentation reads? Co-Authored-By: Claude Opus 5 (1M context) --- website/astro.config.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/website/astro.config.mjs b/website/astro.config.mjs index cc7dece..08a4657 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -7,6 +7,18 @@ export default defineConfig({ base: '/docs', integrations: [ starlight({ + // GoatCounter — same site code as the marketing site, so /docs traffic lands in + // the same dashboard and referrer paths stay comparable. + head: [ + { + tag: 'script', + attrs: { + 'data-goatcounter': 'https://greentea.goatcounter.com/count', + async: true, + src: '//gc.zgo.at/count.js', + }, + }, + ], // Let the content-backed 404.md own /404; otherwise Astro also injects a conflicting route. disable404Route: true, title: 'Green Tea.', -- 2.54.1 From 270480b2d6e377065818348016d968a3d6a36c50 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 7 Aug 2026 14:13:54 -0500 Subject: [PATCH 3/4] docs: fix changelog compare links to point at the public mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CHANGELOG.md ships inside the npm package, and its link references pointed at the internal Gitea host — unreachable for anyone reading the changelog on npmjs. Point them at the GitHub mirror, and compare Unreleased against `main`, since `develop` is not mirrored. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e62d6b..792476e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -153,6 +153,6 @@ change before the stable release. - **Benchmarks** — reproducible `npm run bench` harness vs Express 5, Fastify 5, NestJS, and raw `http`; results in [BENCHMARKS.md](./BENCHMARKS.md). -[Unreleased]: https://git.svc.zoit.services/Green-Tea/core/compare/v26.8.0-beta.0...develop -[26.8.0-beta.0]: https://git.svc.zoit.services/Green-Tea/core/compare/v26.7.0-beta.0...v26.8.0-beta.0 -[26.7.0-beta.0]: https://git.svc.zoit.services/Green-Tea/core/releases/tag/v26.7.0-beta.0 +[Unreleased]: https://github.com/Expressive-Tea/green-tea/compare/v26.8.0-beta.0...main +[26.8.0-beta.0]: https://github.com/Expressive-Tea/green-tea/compare/v26.7.0-beta.0...v26.8.0-beta.0 +[26.7.0-beta.0]: https://github.com/Expressive-Tea/green-tea/releases/tag/v26.7.0-beta.0 -- 2.54.1 From 3a8d93320dd82666150a725a0938abc6106d3630 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 7 Aug 2026 14:22:43 -0500 Subject: [PATCH 4/4] chore: clear the dependency advisories blocking CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both audit trees were failing, for unrelated reasons and with different fixes. **Root — undici, high.** miniflare 4.20260730.0 (the newest stable) pulls undici 7.28.0, and the advisory range is 7.0.0–7.28.0. `npm audit fix --force` wants miniflare 5.20260801.1-alpha: a breaking major, and an alpha, to patch a devDependency that never ships. undici 7.29.0 is outside the range, so pin it through `overrides` instead — same approach already used for find-my-way and hyperid. **website — js-yaml, high.** Reached through Starlight. 4.3.1 carries the fix and the bump is not breaking, so a plain `npm audit fix` covers it. Verified: root and website audits both report 0 vulnerabilities; 357 tests pass; `test:edge` still passes, which is the one that actually exercises miniflare against the pinned undici; `docs:build` produces its 23 pages. Co-Authored-By: Claude Opus 5 (1M context) --- package-lock.json | 54 +++------------------------------------ package.json | 5 ++-- website/package-lock.json | 18 +++---------- 3 files changed, 9 insertions(+), 68 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97da65b..f62ff56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1194,9 +1194,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1214,9 +1211,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1234,9 +1228,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1254,9 +1245,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1274,9 +1262,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1294,9 +1279,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1314,9 +1296,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1334,9 +1313,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1354,9 +1330,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1380,9 +1353,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1406,9 +1376,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1432,9 +1399,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1458,9 +1422,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1484,9 +1445,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1510,9 +1468,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1536,9 +1491,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -7976,9 +7928,9 @@ } }, "node_modules/undici": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.28.0.tgz", - "integrity": "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 6c0b28d..36a63a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@green-tea/core", "version": "26.8.0-beta.0", - "description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.", + "description": "A zen, opinionated, type-safe framework \u2014 your API is a graph, not a middleware chain.", "license": "MIT", "author": "green-tea contributors", "repository": { @@ -126,7 +126,8 @@ "hyperid": { "uuid": "11.1.1" } - } + }, + "undici": "7.29.0" }, "devDependencies": { "@eslint/js": "^9.39.5", diff --git a/website/package-lock.json b/website/package-lock.json index 95d845d..dd061ab 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -70,9 +70,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -89,9 +86,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -108,9 +102,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -127,9 +118,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3848,9 +3836,9 @@ } }, "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "funding": [ { "type": "github", -- 2.54.1