docs: honest README + quickstart, and a Starlight documentation site
CI / build (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
Bring the README in line with what shipped and fill the gaps a technical reader comparing frameworks needs: the busboy peer dep and dual build, a Routing section with its limits, an explicit "bring your own auth" scope note, why legacy decorators is a design choice (not laziness), and CalVer beta versioning. Add a full Astro Starlight docs site under website/ — getting started, concepts, per-feature guides, and an API reference — migrated from the tested quickstart so the examples stay accurate. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
24 files changed
+8275
-7
No files matched your search
@@ -0,0 +1,24 @@
|
||||
---
|
||||
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.
|
||||
|
||||
```typescript
|
||||
import { flow } from '@green-tea/core';
|
||||
|
||||
const pipeline = flow()
|
||||
.step('db', () => ({ find: (id: string) => id }))
|
||||
.step('user', (ctx) => ctx.db.find('u1')); // referencing a missing 'db' would not compile
|
||||
```
|
||||
|
||||
Each `.step(name, fn)` adds its output to the accumulated context **type** (`Acc & Out`). The next step's `ctx` is typed with everything produced so far — so reading `ctx.db` compiles only because a previous step provided `db`. Reference a key nothing produced and it is a **compile error**, not a runtime `undefined`.
|
||||
|
||||
This is the strongest guarantee green-tea offers: the type *is* the dependency contract, checked statically. The decorator layer gives you the same graph with boot-time validation and the ergonomics of classes and decorators; `flow` gives you compile-time proof.
|
||||
|
||||
:::note
|
||||
`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.
|
||||
Reference in new issue
Block a user