okengine 0.18.4 → 0.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okengine",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "One law. Eight elements. One contract. The backend model stays small; operational surfaces are derived from it instead of maintained separately.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -5,20 +5,39 @@ icon: "Bot"
5
5
  source: "docs/spec/unified-theory.md"
6
6
  ---
7
7
 
8
- Resources for AI agents that read or operate an OKE app — not the `ai` element itself. In OKE, **MCP is a surface of the model, not the model itself**. Gate governs agents calling in; the AI element governs apps calling out.
8
+ Resources for AI agents that inspect, understand, or operate an OKEngine application.
9
9
 
10
- ## Pages
10
+ <Callout title="Two directions, one model">
11
+ **MCP is a surface of the model, not the model itself.** Gate governs agents calling in; the AI
12
+ element governs applications calling out to models.
13
+ </Callout>
14
+
15
+ ```text
16
+ External Agents → MCP (:6535) → Gate Check → Flow (inbound)
17
+ Flow → fx.ask / fx.stream → AI Runtime → Models & External Tools (outbound)
18
+ ```
19
+
20
+ ## AI & Agent Surfaces
11
21
 
12
22
  <Cards>
13
- <Card title="MCP" description="Runtime MCP on :6535; docs MCP on :6536." href="/docs/ai/mcp" />
14
23
  <Card
15
- title="Skills"
16
- description="AGENTS.md contract and installable skills."
24
+ title="MCP"
25
+ description="Runtime MCP on :6535 for running apps; Docs MCP on :6536 for handbook search."
26
+ href="/docs/ai/mcp"
27
+ />
28
+ <Card
29
+ title="Agent Skills"
30
+ description="AGENTS.md contract and autonomous maintenance skills."
17
31
  href="/docs/ai/skills"
18
32
  />
19
33
  <Card
20
34
  title="llms.txt"
21
- description="Index, JSON catalogue, full dump, per-page markdown."
35
+ description="Standardized machine-readable feeds: /llms.txt, /llms.json, /llms-full.txt, and markdown twins."
22
36
  href="/docs/ai/llms-txt"
23
37
  />
38
+ <Card
39
+ title="AI Element"
40
+ description="Calling out: models, prompts, agents, and RAG inside your application."
41
+ href="/docs/elements/ai"
42
+ />
24
43
  </Cards>
@@ -1,45 +1,76 @@
1
1
  ---
2
2
  title: "Elements"
3
- description: "The eight irreducible parts of an OKE backend — Flow through AI, one page each."
3
+ description: "The eight closed semantic primitives of the OKEngine backend model."
4
4
  icon: "Boxes"
5
5
  source: "docs/spec/unified-theory.md"
6
6
  ---
7
7
 
8
- Every backend concern collapses to one of these eight. Pick the element you need.
8
+ Forty backend concerns collapse into eight semantic primitives. An element earns its place only with **irreducible physics**.
9
9
 
10
- ## Pages
10
+ <Callout title="Closed primitive set">
11
+ There is no ninth element. New infrastructure creates a protocol driver or plugin, preserving a
12
+ small mental model.
13
+ </Callout>
14
+
15
+ ```text
16
+ Elements define the model.
17
+ Plugins extend the model's capabilities.
18
+ Drivers connect the model to infrastructure.
19
+ Providers and Recipes choose where that infrastructure runs.
20
+ ```
21
+
22
+ ## The Eight Primitives
11
23
 
12
24
  <Cards>
13
- <Card title="Flow" description="Behavior — on(Trigger) → Effects." href="/docs/elements/flow" />
25
+ <Card
26
+ title="Flow"
27
+ description="Behavior — on(Trigger) → Effects via fx."
28
+ href="/docs/elements/flow"
29
+ />
14
30
  <Card
15
31
  title="Signal"
16
- description="Data in motion — queues, pub/sub, streams."
32
+ description="Data in motion — delivery physics as a property (once, broadcast, live)."
17
33
  href="/docs/elements/signal"
18
34
  />
19
35
  <Card
20
36
  title="Store"
21
- description="Data at rest — sql, kv, files, index."
37
+ description="Data at rest — SQL, KV, files with image transforms, and search."
22
38
  href="/docs/elements/store"
23
39
  />
24
40
  <Card
25
41
  title="Clock"
26
- description="Time — schedules, intervals, durable sleeps."
42
+ description="Time — schedules, intervals, durable sleeps, and time travel."
27
43
  href="/docs/elements/clock"
28
44
  />
29
45
  <Card
30
46
  title="Gate"
31
- description="Permission to act — auth and rate limits."
47
+ description="Permission to act — auth, tenancy, ABAC, and rate limits at the trigger."
32
48
  href="/docs/elements/gate"
33
49
  />
34
50
  <Card
35
51
  title="Vault"
36
- description="Protected knowledge — secrets and keys."
52
+ description="Protected knowledge — fail-loud secret contracts and redacted values."
37
53
  href="/docs/elements/vault"
38
54
  />
39
55
  <Card
40
56
  title="Channel"
41
- description="Reaching humans — email, SMS, push."
57
+ description="Reaching humans — email, SMS, WhatsApp, and push with built-in consent."
42
58
  href="/docs/elements/channel"
43
59
  />
44
- <Card title="AI" description="Reaching machine intelligence." href="/docs/elements/ai" />
60
+ <Card
61
+ title="AI"
62
+ description="Reaching machine intelligence — models, prompts, agents, and RAG."
63
+ href="/docs/elements/ai"
64
+ />
45
65
  </Cards>
66
+
67
+ ## See How They Compose
68
+
69
+ The closed elements compose into full backend capabilities:
70
+
71
+ | Composition Target | Formula | How It Works |
72
+ | ------------------ | ----------------------------------------------- | --------------------------------------------------------- |
73
+ | **Realtime** | Store + Gate + Signal + Flow → Live Query | CDC changes re-checked against Gate RLS, streamed as SSE |
74
+ | **Security** | Gate + Store/RLS + Tenant + fx → Secure runtime | Tenant-isolated queries with least-privilege capability |
75
+ | **Agents** | MCP + Gate + OAuth + Flow → Agent-ready backend | Declared Flows exposed on :6535 behind auth confirmation |
76
+ | **Operations** | Manifest + Effects + Runs → Inspectable backend | Inferred effects feed Console (:6533) and wide-event logs |
@@ -1,22 +1,13 @@
1
1
  ---
2
2
  title: Introduction
3
- description: Learn the one idea behind okengine — then the eight elements and core programming vocabulary you will use everywhere.
3
+ description: The Law, the eight elements, the fx rule, and the compiled Manifest contract.
4
4
  source: docs/spec/unified-theory.md
5
5
  icon: BookOpen
6
6
  ---
7
7
 
8
- ## The One Idea
8
+ ## The One Law
9
9
 
10
- A booking API, a nightly cleanup job, a receipt email, a row-change hook — in most stacks those are four frameworks. In OKE they are **one species** with one shape. Learn the shape once; only the trigger changes.
11
-
12
- > **The one rule**
13
- > Every backend behavior is a **Flow**: `on(Trigger) → Effects`. There are no separate species called endpoints, handlers, consumers, jobs, or workflows.
14
-
15
- ## Quick Start
16
-
17
- ### Write One Flow
18
-
19
- Four contracts plus a `do`. This is the standard starter's health check:
10
+ Every backend behavior is a Flow: `on(Trigger) Effects`.
20
11
 
21
12
  ```typescript
22
13
  import { on, flow, http } from "okengine/http";
@@ -24,11 +15,11 @@ import { on, flow, http } from "okengine/http";
24
15
  export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
25
16
  ```
26
17
 
27
- `main` omits the URL prefix, so this file is `GET /health` named `main.health`. See [Project structure](/docs/get-started/project-structure). Explicit `http.get("/health")` and `flow("main.health")` still win.
18
+ An endpoint, a nightly cleanup cron, a queue consumer, a row-change CDC hook these are not four frameworks. They are **one species** with one shape. Only the trigger changes.
28
19
 
29
- ### Change Only the Trigger
20
+ ## Changing Only the Trigger
30
21
 
31
- Triggers define what starts the flow. Changing the trigger replaces the entire behavior while keeping the same structure:
22
+ Triggers determine what starts the flow while preserving identical anatomy and effect tracking:
32
23
 
33
24
  | Trigger | Starts when | Replaces |
34
25
  | ---------------------------------- | ------------------ | ------------------ |
@@ -46,9 +37,9 @@ on(orderPlaced, sendReceipt);
46
37
  on(db.table(users).changed("email"), reverify);
47
38
  ```
48
39
 
49
- ## Anatomy
40
+ ## Anatomy of a Flow
50
41
 
51
- One pipeline. Only the trigger changes between an endpoint, a job, a consumer, and a row hook.
42
+ Every Flow consists of four clear sections:
52
43
 
53
44
  | Piece | Role |
54
45
  | ------------- | -------------------------------------------------------------- |
@@ -57,35 +48,53 @@ One pipeline. Only the trigger changes between an endpoint, a job, a consumer, a
57
48
  | **`do`** | The body — every read, write, emit, and call goes through `fx` |
58
49
  | **Effects** | Inferred from those `fx` calls — not hand-annotated |
59
50
 
60
- Consequence: One documentation path, one trace shape, one Flow model, one thing for an AI agent to learn.
51
+ ```typescript
52
+ export const createOrder = on(
53
+ http.post("/orders"),
54
+ flow("orders.create", {
55
+ in: OrderInput,
56
+ out: OrderResult,
57
+ do: async (input, fx) => {
58
+ const order = await fx.store(db).insert(orders).values(input);
59
+ await fx.emit(orderPlaced, { orderId: order.id });
60
+ return order;
61
+ },
62
+ }),
63
+ );
64
+ ```
61
65
 
62
66
  ## The `fx` Rule
63
67
 
64
- **All world access goes through `fx`.** A Flow that imports `node:fs`, calls `fetch` directly, or uses `Date.now()` is a defect.
68
+ **All world access goes through `fx`.**
69
+
70
+ <Callout title="Single door to the world">
71
+ Nothing in user flows imports `node:fs`, calls global `fetch`, or calls `Date.now()`. Every effect
72
+ is recorded on the effect ledger.
73
+ </Callout>
65
74
 
66
- | Inferred From | With `fx` |
67
- | ----------------------- | --------- |
68
- | Cache invalidation keys | Yes |
69
- | Live queries | Yes |
70
- | Least-privilege tokens | Yes |
71
- | Deterministic tests | Yes |
72
- | Manifest Diff | Yes |
75
+ | Inferred from `fx` | What it powers |
76
+ | ----------------------- | ------------------------------------ |
77
+ | Cache invalidation keys | Invalidation follows the flow writes |
78
+ | Live queries | Realtime CDC subscriptions |
79
+ | Least-privilege tokens | Compiler-derived capability matrix |
80
+ | Deterministic tests | Injected time, clock, and stores |
81
+ | Manifest Diff | Blast-radius checks on every save |
73
82
 
74
- ## What the Manifest Derives
83
+ ## The Compiled Manifest
75
84
 
76
- At build time OKE extracts a **Manifest** a machine-readable description of your system. You do not maintain a second source of truth.
85
+ The source of truth is the backend model expressed in code. The **Manifest** is the compiled, versioned contract representing that model.
77
86
 
78
- | Surface | Port / Place | You Maintain? |
87
+ | Surface | Port | You Maintain? |
79
88
  | --------------------------------- | ------------------ | ----------------------------- |
80
- | Typed client (`okengine/client`) | your app code | No separate codegen |
81
- | Console panels, traces, explorers | `:6533` | No |
82
- | MCP for agents | `:6535` | No |
89
+ | Typed client (`okengine/client`) | your app code | No derived from Manifest |
90
+ | Console panels, traces, explorers | `:6533` | No — reads the Manifest |
91
+ | MCP for agents | `:6535` | No — reads the Manifest |
83
92
  | Architecture diagram | Console | No — it _is_ the effect graph |
84
- | Capability matrix + cache keys | compiler / runtime | No — from `fx` |
93
+ | Capability matrix + cache keys | compiler / runtime | No — inferred from `fx` |
85
94
 
86
95
  ## The Eight Elements
87
96
 
88
- An element earns its place only if it has **irreducible physics**. New infrastructure becomes a new **driver** — never a ninth element.
97
+ An element earns its place only if it has **irreducible physics**.
89
98
 
90
99
  | Element | Essence | Replaces the Zoo |
91
100
  | ----------- | ----------------------------- | --------------------------------------------------------- |
@@ -98,35 +107,38 @@ An element earns its place only if it has **irreducible physics**. New infrastru
98
107
  | **Channel** | Reaching humans | email · SMS · WhatsApp · push |
99
108
  | **AI** | Reaching machine intelligence | model calls · prompts · embeddings · agents · RAG |
100
109
 
110
+ New infrastructure becomes a **driver** for an existing element, never a ninth.
111
+
101
112
  ## Core Programming Vocabulary
102
113
 
103
- The core programming vocabulary fits in one import. Everything else in the docs is derived from these names:
114
+ The core programming vocabulary is ten exported names:
104
115
 
105
- ```ts
116
+ ```typescript
106
117
  import { on, flow, signal, store, clock, gate, vault, channel, ai, plugin } from "okengine";
107
118
  ```
108
119
 
109
- For HTTP-only apps, prefer the slim entry so the cold graph stays on the edge:
120
+ For HTTP runtime essentials, use the slim entry `okengine/http`:
110
121
 
111
- ```ts
122
+ ```typescript
112
123
  import { on, flow, http, gate, oke, createBunRuntime } from "okengine/http";
113
124
  ```
114
125
 
115
- Heavy surfaces (runs, journal factories, compiler extract, the legacy mega-barrel) live on `okengine/runs`, `okengine/journal`, `okengine/compiler`, and `okengine/full`.
116
-
117
- ## Learn More
118
-
119
- | Topic | Page |
120
- | ------- | ------------------------------------------------------------------------------- |
121
- | Why OKE | [Why OKE](/docs/get-started/why) |
122
- | Folders | [Project structure](/docs/get-started/project-structure) |
123
- | Flow | [Flow](/docs/elements/flow) |
124
- | `fx` | [fx](/docs/reference/fx) |
125
- | Agents | [MCP](/docs/ai/mcp) · [Skills](/docs/ai/skills) · [llms.txt](/docs/ai/llms-txt) |
126
-
127
126
  ## Next Steps
128
127
 
129
- - [Why OKE](/docs/get-started/why)
130
- - [Installation](/docs/get-started/installation)
131
- - [Basic Usage](/docs/get-started/basic-usage)
132
- - [Project Structure](/docs/get-started/project-structure)
128
+ <Cards>
129
+ <Card
130
+ title="Why OKE"
131
+ description="Explore the problem of seams and the smaller model."
132
+ href="/docs/get-started/why"
133
+ />
134
+ <Card
135
+ title="Installation"
136
+ description="Scaffold a new OKEngine project with create-oke."
137
+ href="/docs/get-started/installation"
138
+ />
139
+ <Card
140
+ title="Basic Usage"
141
+ description="Write your first flow and verify it with bun test."
142
+ href="/docs/get-started/basic-usage"
143
+ />
144
+ </Cards>
@@ -1,162 +1,114 @@
1
1
  ---
2
2
  title: Why OKE
3
- description: From forty tools to one species the Manifest, the `fx` rule, and the eight closed elements.
3
+ description: The problem of seams across independent backend tools, the insight, and the smaller model.
4
4
  source: docs/spec/unified-theory.md
5
5
  icon: Compass
6
6
  ---
7
7
 
8
- ## From forty tools to one species
8
+ ## The Problem: The Seams You Own
9
9
 
10
- A booking API, a nightly cleanup job, a receipt email, a row-change hook in most stacks these are **four frameworks**. In OKE they are **one species** with one shape. Learn the shape once; only the trigger changes.
11
-
12
- > **The one rule**
13
- > Every backend behavior is a **Flow**: `on(Trigger) → Effects`. There are no separate species called endpoints, handlers, consumers, jobs, or workflows.
10
+ Modern backends accumulate many independently adopted systems: router, queue, cron, websockets, cache, secrets, mailer, AI wrappers, and observability.
14
11
 
15
12
  <Callout title="A note on the count">
16
13
  'Forty' is a representative illustration of the number of backend concerns developers commonly
17
- assemble across modern stacks, not a literal count of backend technologies.
14
+ assemble across modern stacks, not a literal census.
18
15
  </Callout>
19
16
 
20
- ## The pain we solve
21
-
22
- Every TypeScript backend works on day one. The bill arrives later. None of these are router problems — they are **gaps** between what your code knows and what your tooling knows.
23
-
24
- ### Cache that lies
25
-
26
- You add a column to `orders` and update three writers. The cache key in `checkout` is not one of them. A customer finds it a week later.
27
-
28
- OKE derives: reads and writes are recorded through `fx`, so cache invalidation follows the Flow — there is no separate key to remember.
17
+ ```text
18
+ many systems → many seams → many contracts → many mental models
19
+ ```
29
20
 
30
- ### Secret that fails at 2am
21
+ Every TypeScript backend works on day one. The bill arrives later in the seams:
31
22
 
32
- `STRIPE_KEY` lives in your laptop's `.env`, a README, and a teammate's shell history. The deploy boots fine — the first charge request dies at 2am.
23
+ - **Cache that lies:** You update a writer, but forget the cache key in checkout.
24
+ - **Secret that fails at 2am:** Deploy boots fine; the first charge fails because the env var was missed.
25
+ - **Permission checks in the wrong place:** Auth logic scattered across handlers instead of verified at the trigger.
26
+ - **The dashboard that doesn't know you:** Observability tools learn routes from traffic samples instead of the compiled model.
33
27
 
34
- OKE derives: [Vault](/docs/elements/vault) contracts declare the need in code; boot resolves every contract and **fails loud** with every gap listed — never halfway.
28
+ ## The Insight: One Programming Model
35
29
 
36
- ### The glue you rewrite
30
+ These concerns do not need to become separate programming concepts. They collapse into one closed set:
37
31
 
38
- CORS rules, security headers, CSRF tokens, compression — copied from the last repo, tweaked, and already drifting from whatever that repo does today.
32
+ ```text
33
+ Many backend concerns → One programming model
34
+ ```
39
35
 
40
- OKE derives: the official `okengine/plugins` set ships this glue once — shared lifecycle, optional live DB config, nothing to re-copy.
36
+ > **One law. Eight elements. One contract.**
41
37
 
42
- ### The dashboard that doesn't know you
38
+ ## Wrong vs. Right Mental Model
43
39
 
44
- Your observability stack learned your routes from sampled traffic. The Flow you deployed an hour ago is invisible until someone wires it by hand.
40
+ Understanding OKE begins by rejecting the conventional feature-pile model:
45
41
 
46
- OKE derives: its operator interface reads the Manifest flows, effects, traces, architecture — current on every save, in dev and prod (`:6533`).
42
+ | Wrong Mental Model (Feature Bundle) | OKEngine Model (Unified Primitives) |
43
+ | -------------------------------------- | -------------------------------------- |
44
+ | Router + Queue + Cron + Auth + ORM | `on(Trigger) → Flow` (One species) |
45
+ | Separate mental model per tool | Eight closed semantic elements |
46
+ | Ad-hoc side effects everywhere | Single door to the world: `fx` |
47
+ | Hand-maintained glue & OpenAPI | Compiled Manifest contract |
48
+ | Unchecked runtime drift | Derived, inspectable surfaces |
47
49
 
48
- ### Permission check in the wrong place
50
+ The difference is not how many features OKE has. It is how few concepts you need to understand.
49
51
 
50
- `if (!user.isAdmin)` sits in handler forty-one of sixty. Which Flows touch `payments`? grep answers slowly; review answers never.
52
+ ## The Law and the `fx` Rule
51
53
 
52
- OKE derives: declared effects produce a **least-privilege matrix** — widening access appears in Manifest Diff, not in a diff nobody reads.
54
+ Every backend behavior is a Flow:
53
55
 
54
- ### Local works, prod doesn't
56
+ ```typescript
57
+ import { on, flow, http } from "okengine/http";
55
58
 
56
- Local runs one vendor client, CI another, prod a third three glue stories for the same database.
59
+ export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
60
+ ```
57
61
 
58
- OKE derives: drivers are named after protocols (`postgres`, `redis`, `s3`), the vendor lives in `images`, and `oke dev` runs the real stack locally.
62
+ **All world access goes through `fx`.** A Flow that calls `fetch` directly, imports `node:fs`, or uses `Date.now()` is a defect.
59
63
 
60
- ---
64
+ ```text
65
+ Flow → fx → observable Effects → Compiler → Manifest → Surfaces
66
+ ```
61
67
 
62
- Every gap above is the same shape: knowledge the code already has, duplicated somewhere the compiler cannot check. **The tax is drift.** One change costs fifteen seams to update by hand; in OKE it always costs one.
68
+ Because all effects pass through `fx`, the compiler infers cache keys, capability matrices, and trace trees without manual annotations.
63
69
 
64
- ## One Manifest feeds every surface
70
+ ## One Contract, Many Surfaces
65
71
 
66
- At build time OKE extracts a **Manifest** — the compiled, versioned contract between your backend model and everything derived from it. The source of truth is your model expressed in code (`on(Trigger) Flow fx Effects`); the Manifest freezes that model into a machine-readable, diffable contract. You do not write or hand-maintain the Manifest:
72
+ The source of truth is the backend model expressed in code. The **Manifest** is the compiled, versioned contract representing that model.
67
73
 
68
- | Surface | Port | You maintain? |
74
+ | Surface | Port | You Maintain? |
69
75
  | --------------------------------- | ------------------ | ----------------------------- |
70
- | Typed client (`okengine/client`) | your app code | No — derived from `Manifest` |
76
+ | Typed client (`okengine/client`) | your app code | No — derived from Manifest |
71
77
  | Console panels, traces, explorers | `:6533` | No — reads the Manifest |
72
78
  | MCP for agents | `:6535` | No — reads the Manifest |
73
79
  | Architecture diagram | Console | No — it _is_ the effect graph |
74
80
  | Capability matrix + cache keys | compiler / runtime | No — inferred from `fx` |
75
81
 
76
- Because every surface reads the same Manifest contract, they **cannot disagree** — there is only one source of truth.
77
-
78
- ## The `fx` rule — one door to the world
82
+ Operational surfaces are derived, not separately maintained.
79
83
 
80
- **All world access goes through `fx`.** A Flow that imports `node:fs`, calls `fetch` directly, or uses `Date.now()` is a defect. Effects are **inferred from what a Flow touches through `fx`**, and that inference powers the Manifest, the Console, caching, and durability.
81
-
82
- <Callout title="What `fx` records">
83
- Every read, write, emit, send, ask, secret, and call is captured — so the Manifest knows exactly
84
- which flows touch `orders` or send PII to a model, without you declaring it.
85
- </Callout>
84
+ ## See the Model Compose
86
85
 
87
- | Inferred from `fx` | What it gives you |
88
- | ----------------------- | ------------------------------------ |
89
- | Cache invalidation keys | Automatic — follows the Flow |
90
- | Live queries | Built-in subscription model |
91
- | Least-privilege tokens | Capability matrix from effects |
92
- | Deterministic tests | Time, clock, and randomness injected |
93
- | Manifest Diff | Exact change surface on every save |
86
+ OKE does not add new subsystems when new architectural requirements emerge. The eight closed primitives compose naturally:
94
87
 
95
- ## Eight elements a closed set
88
+ - **Realtime:** `Store + Gate + Signal + Flow → Live Query` (Global CDC + RLS re-check + SSE).
89
+ - **Security:** `Gate + Store/RLS + Tenant + fx → Secure execution` (Unified user, operator, and agent boundaries).
90
+ - **Agents:** `MCP + Gate + OAuth + Flow → Agent-accessible backend` (Exposing Flows as MCP tools).
91
+ - **Operations:** `Manifest + Effects + Runs → Inspectable backend` (Wide-event telemetry and live graphs).
96
92
 
97
- Forty infrastructure concerns collapse into eight elements — each kept only because it has **irreducible physics**. New infrastructure becomes a **driver** for an existing element, never a ninth.
93
+ > **None of these required a ninth primitive.**
98
94
 
99
- | Element | Essence | Replaces the zoo |
100
- | ----------- | ----------------------------- | --------------------------------------------------------- |
101
- | **Flow** | Behavior | endpoint · handler · consumer · job · workflow · webhook |
102
- | **Signal** | Data in motion | queue · pub/sub · stream · websocket · SSE · event bus |
103
- | **Store** | Data at rest | database · cache · KV · file storage · search index |
104
- | **Clock** | Time | cron · delay · timeout · durable sleep · TTL |
105
- | **Gate** | Permission to act | auth · session · ABAC · rate limit · quota · feature flag |
106
- | **Vault** | Protected knowledge | secrets · config · environment |
107
- | **Channel** | Reaching humans | email · SMS · WhatsApp · push |
108
- | **AI** | Reaching machine intelligence | model calls · prompts · embeddings · agents · RAG |
95
+ ## Core Philosophy
109
96
 
110
- Drivers are named after **protocols** (`postgres`, `redis`, `s3`) — never vendors. The vendor lives in `images`, and `oke dev` runs the real stack locally.
97
+ > **Keep the model small. Let the backend grow without growing the mental model.**
111
98
 
112
- ## The shape of a Flow
99
+ Your backend is not just executable. It is inspectable.
113
100
 
114
- One pipeline. Only the trigger changes between an endpoint, a job, a consumer, and a row hook:
115
-
116
- ```ts
117
- import { on, flow, http } from "okengine/http";
118
-
119
- export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
120
- ```
121
-
122
- | Piece | Role |
123
- | ------------- | -------------------------------------------------------------- |
124
- | **Trigger** | How work starts — `http`, a signal, `every`, a row change |
125
- | **Contracts** | `in`, `out`, typed `errors` — validated before and after `do` |
126
- | **`do`** | The body — every read, write, emit, and call goes through `fx` |
127
- | **Effects** | Inferred from those `fx` calls — not hand-annotated |
128
-
129
- Consequence: **one documentation path, one trace shape, one Flow model, one thing for an AI agent to learn.**
130
-
131
- ## Ambition, stated plainly
132
-
133
- > **Ambition**: The default, most capable TypeScript backend — Bun-first, Web-Standards portable, contract-first
134
- > **Grounded in**: Eight elements, effect inference through `fx`, Gate and Vault, the official plugin set
135
- > **Maturity**: **pre-1.0** — published and usable; not independently battle-tested at scale yet
136
-
137
- ## Learn more
138
-
139
- - [Introduction](/docs/get-started/introduction) — the one law, eight elements, one contract
140
- - [Flow](/docs/elements/flow) — how effects are recorded and inferred
141
- - [Vault](/docs/elements/vault) — fail-loud secret contracts
142
- - [Plugins](/docs/reference/plugins) — the official HTTP glue set
143
-
144
- ## Next
101
+ ## Next Steps
145
102
 
146
103
  <Cards>
147
- <Card
148
- title="Installation"
149
- description="Scaffold with create-oke and open the Console."
150
- href="/docs/get-started/installation"
151
- />
152
- <Card
153
- title="Basic Usage"
154
- description="Health Flow, typed client, and bun:test."
155
- href="/docs/get-started/basic-usage"
156
- />
157
104
  <Card
158
105
  title="Introduction"
159
- description="The one law, eight elements, one contract."
106
+ description="The Law, Flow anatomy, and the eight elements."
160
107
  href="/docs/get-started/introduction"
161
108
  />
109
+ <Card
110
+ title="Installation"
111
+ description="Scaffold your first project with create-oke."
112
+ href="/docs/get-started/installation"
113
+ />
162
114
  </Cards>