okengine 0.3.6 → 0.5.0
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/AGENTS.md +2 -0
- package/package.json +14 -12
- package/site/content/docs/ai/index.mdx +24 -0
- package/site/content/docs/ai/llms-txt.mdx +3 -0
- package/site/content/docs/ai/meta.json +1 -1
- package/site/content/docs/ai/skills.mdx +5 -3
- package/site/content/docs/console/gates.mdx +46 -8
- package/site/content/docs/console/index.mdx +54 -0
- package/site/content/docs/console/meta.json +1 -0
- package/site/content/docs/elements/ai.mdx +2 -0
- package/site/content/docs/elements/channel.mdx +2 -0
- package/site/content/docs/elements/clock.mdx +1 -4
- package/site/content/docs/elements/flow.mdx +4 -10
- package/site/content/docs/elements/gate.mdx +189 -48
- package/site/content/docs/elements/index.mdx +45 -0
- package/site/content/docs/elements/meta.json +1 -1
- package/site/content/docs/elements/signal.mdx +1 -5
- package/site/content/docs/elements/store.mdx +27 -6
- package/site/content/docs/elements/vault.mdx +10 -11
- package/site/content/docs/get-started/basic-usage.mdx +79 -43
- package/site/content/docs/get-started/index.mdx +33 -0
- package/site/content/docs/get-started/installation.mdx +95 -43
- package/site/content/docs/get-started/introduction.mdx +128 -75
- package/site/content/docs/get-started/meta.json +1 -1
- package/site/content/docs/get-started/why.mdx +141 -0
- package/site/content/docs/index.mdx +9 -31
- package/site/content/docs/plugins/anonymous.mdx +95 -0
- package/site/content/docs/plugins/compression.mdx +2 -2
- package/site/content/docs/plugins/cors.mdx +2 -2
- package/site/content/docs/plugins/csrf.mdx +2 -2
- package/site/content/docs/plugins/email-otp.mdx +111 -0
- package/site/content/docs/plugins/{security-headers.mdx → headers.mdx} +2 -2
- package/site/content/docs/plugins/index.mdx +69 -0
- package/site/content/docs/plugins/ip-allowlist.mdx +1 -2
- package/site/content/docs/plugins/magic-link.mdx +112 -0
- package/site/content/docs/plugins/maintenance-mode.mdx +8 -8
- package/site/content/docs/plugins/meta.json +10 -1
- package/site/content/docs/plugins/passkey.mdx +128 -0
- package/site/content/docs/plugins/phone-number.mdx +111 -0
- package/site/content/docs/plugins/two-factor.mdx +116 -0
- package/site/content/docs/plugins/username.mdx +117 -0
- package/site/content/docs/reference/client.mdx +331 -0
- package/site/content/docs/reference/configuration.mdx +1 -1
- package/site/content/docs/reference/environment-variables.mdx +5 -3
- package/site/content/docs/reference/fx.mdx +36 -8
- package/site/content/docs/reference/index.mdx +45 -0
- package/site/content/docs/reference/meta.json +11 -1
- package/site/content/docs/reference/plugins.mdx +25 -14
- package/src/auth/auth.test.ts +20 -2
- package/src/auth/bindings.ts +439 -0
- package/src/auth/breach-check.ts +112 -0
- package/src/auth/config.ts +288 -0
- package/src/auth/cookies.ts +123 -0
- package/src/auth/gate-auth.test.ts +379 -0
- package/src/auth/identity.ts +190 -0
- package/src/auth/index.ts +117 -1
- package/src/auth/method-context.ts +33 -0
- package/src/auth/operator.ts +27 -1
- package/src/auth/password-policy.test.ts +126 -0
- package/src/auth/password-policy.ts +77 -0
- package/src/auth/plugin.ts +62 -4
- package/src/auth/rate.ts +45 -0
- package/src/auth/schema.ts +260 -0
- package/src/auth/secondary-storage.ts +37 -0
- package/src/auth/sessions.ts +58 -1
- package/src/auth/tables.ts +4 -0
- package/src/auth/verification.ts +78 -0
- package/src/cli/competitor-mention-removal.test.ts +117 -0
- package/src/cli/dev.test.ts +3 -3
- package/src/cli/dev.ts +20 -0
- package/src/cli/meilisearch-local.test.ts +69 -0
- package/src/cli/meilisearch-local.ts +188 -0
- package/src/cli/schema.ts +95 -23
- package/src/client/auth.ts +120 -0
- package/src/client-react/index.ts +93 -0
- package/src/compiler/aot.test.ts +2 -1
- package/src/compiler/extract.ts +19 -0
- package/src/compiler/fixtures/skyport/src/flows/payments/index.ts +5 -1
- package/src/compiler/response.ts +16 -2
- package/src/console/server/app.ts +10 -6
- package/src/console/server/auth-rate.test.ts +3 -3
- package/src/console/server/bind.ts +12 -1
- package/src/console/server/channels.test.ts +1 -1
- package/src/console/server/console-gates.ts +14 -0
- package/src/console/server/console.test.ts +6 -6
- package/src/console/server/flows-invoke.test.ts +2 -2
- package/src/console/server/flows.ts +2 -0
- package/src/console/server/gates.ts +8 -1
- package/src/console/server/operator-db.test.ts +4 -4
- package/src/console/server/operator-db.ts +22 -4
- package/src/console/server/security.gate.test.ts +3 -3
- package/src/console/server/store.test.ts +1 -1
- package/src/console/server/store.ts +11 -1
- package/src/console/ui/dist/assets/index-CjxwRGVv.js +10 -0
- package/src/console/ui/dist/assets/panel-access-BGv45snf.js +64 -0
- package/src/console/ui/dist/assets/{panel-ai-D_m6WQI8.js → panel-ai-B2S7LEii.js} +1 -1
- package/src/console/ui/dist/assets/{panel-architecture-CKnXFyUx.js → panel-architecture-D7UJh91v.js} +1 -1
- package/src/console/ui/dist/assets/{panel-channels-DCDd4WAC.js → panel-channels-9T3ybqRu.js} +1 -1
- package/src/console/ui/dist/assets/panel-clock-Cb1UXGRQ.js +1 -0
- package/src/console/ui/dist/assets/{panel-diff-cdonmH8c.js → panel-diff-DmYbKWmN.js} +1 -1
- package/src/console/ui/dist/assets/panel-flows-PiHwT55z.js +48 -0
- package/src/console/ui/dist/assets/{panel-gates-B5eTE8XH.js → panel-gates-BQGYXvjT.js} +1 -1
- package/src/console/ui/dist/assets/panel-overview-BBnRO18l.js +1 -0
- package/src/console/ui/dist/assets/{panel-plugins-Cj7DK1er.js → panel-plugins-D0PsmVw2.js} +1 -1
- package/src/console/ui/dist/assets/panel-runs-CWuRDe0r.js +1 -0
- package/src/console/ui/dist/assets/{panel-signals-whmDXIg3.js → panel-signals-Bbg4ewpP.js} +1 -1
- package/src/console/ui/dist/assets/{panel-store-CEMHLvaw.js → panel-store-CPCbsDRa.js} +1 -1
- package/src/console/ui/dist/assets/panel-traces-DVAzuA_S.js +1 -0
- package/src/console/ui/dist/assets/{panel-vault-C9wjbki8.js → panel-vault-D1_MvOmo.js} +1 -1
- package/src/console/ui/dist/assets/{rolldown-runtime-CNC7AqOf.js → rolldown-runtime-B0Z9INg1.js} +1 -1
- package/src/console/ui/dist/index.html +2 -2
- package/src/console/ui/gates/fixture.ts +4 -0
- package/src/console/ui/gates/types.ts +2 -0
- package/src/console/ui/shell/client.ts +1 -0
- package/src/docker/compose.ts +5 -0
- package/src/docker/docker.test.ts +41 -0
- package/src/docker/recipes/index.ts +10 -2
- package/src/docker/recipes/meilisearch.ts +31 -0
- package/src/drivers/conformance.test.ts +16 -1
- package/src/drivers/conformance.ts +40 -3
- package/src/drivers/index.ts +14 -2
- package/src/drivers/libsql.ts +4 -4
- package/src/drivers/meilisearch.integration.test.ts +77 -0
- package/src/drivers/meilisearch.test.ts +181 -0
- package/src/drivers/meilisearch.ts +208 -0
- package/src/drivers/memory.ts +4 -4
- package/src/drivers/pgvector.ts +6 -6
- package/src/drivers/types.ts +93 -12
- package/src/drivers/vault-driver-removal.test.ts +6 -0
- package/src/drivers/vault-types.ts +4 -4
- package/src/elements/ai/runtime.ts +6 -0
- package/src/elements/ai.test.ts +22 -0
- package/src/elements/gate/boot.ts +136 -0
- package/src/elements/gate/config.ts +69 -0
- package/src/elements/gate/declare.ts +51 -1
- package/src/elements/gate/runtime.ts +3 -1
- package/src/elements/gate.test.ts +77 -0
- package/src/elements/gate.ts +20 -1
- package/src/elements/index.ts +8 -0
- package/src/elements/store/index-boot.test.ts +49 -7
- package/src/elements/store/runtime.ts +50 -15
- package/src/elements/store.ts +2 -0
- package/src/elements/vault.test.ts +27 -4
- package/src/elements/vault.ts +1 -1
- package/src/index.ts +15 -0
- package/src/kernel/app.ts +253 -32
- package/src/kernel/boot-bind/store.test.ts +9 -0
- package/src/kernel/boot-bind/store.ts +30 -2
- package/src/kernel/boot.test.ts +40 -3
- package/src/kernel/boot.ts +8 -0
- package/src/kernel/call.test.ts +46 -2
- package/src/kernel/concurrency.test.ts +58 -0
- package/src/kernel/concurrency.ts +48 -0
- package/src/kernel/edge.test.ts +3 -3
- package/src/kernel/flow.test.ts +2 -2
- package/src/kernel/fx.test.ts +12 -2
- package/src/kernel/fx.ts +97 -5
- package/src/kernel/hooks.test.ts +4 -4
- package/src/kernel/index.ts +22 -1
- package/src/kernel/pipeline.test.ts +12 -8
- package/src/kernel/pipeline.ts +23 -4
- package/src/kernel/plugin/decorate.test.ts +3 -3
- package/src/kernel/plugin/scoping.test.ts +3 -3
- package/src/kernel/plugin-elements.test.ts +51 -0
- package/src/kernel/plugin-needs.test.ts +83 -0
- package/src/kernel/plugin-needs.ts +129 -0
- package/src/kernel/plugin.ts +101 -0
- package/src/kernel/redacted.ts +74 -0
- package/src/kernel/registry-isolation.test.ts +5 -5
- package/src/kernel/registry.ts +102 -3
- package/src/kernel/router.ts +3 -3
- package/src/manifest/types.ts +2 -0
- package/src/plugins/anonymous.ts +58 -0
- package/src/plugins/auth/shared.ts +121 -0
- package/src/plugins/auth-methods.test.ts +176 -0
- package/src/plugins/compression.test.ts +5 -5
- package/src/plugins/config-source.test.ts +1 -1
- package/src/plugins/cors.test.ts +16 -10
- package/src/plugins/csrf.test.ts +1 -1
- package/src/plugins/email-otp.ts +161 -0
- package/src/plugins/index.ts +31 -0
- package/src/plugins/ip-allowlist.test.ts +19 -9
- package/src/plugins/magic-link.ts +163 -0
- package/src/plugins/maintenance-mode.test.ts +9 -5
- package/src/plugins/passkey.ts +216 -0
- package/src/plugins/phone-number.ts +149 -0
- package/src/plugins/security-headers.test.ts +14 -14
- package/src/plugins/two-factor.ts +249 -0
- package/src/plugins/username.ts +148 -0
- package/src/runs/runs.test.ts +6 -2
- package/src/runtime/primitives.ts +37 -4
- package/src/runtime/serve.test.ts +3 -2
- package/src/runtime/types.ts +25 -2
- package/src/test/create-test-app.test.ts +1 -1
- package/src/test/create-test-app.ts +4 -1
- package/src/test/provisions.integration.test.ts +2 -2
- package/site/content/docs/get-started/comparison.mdx +0 -65
- package/src/console/ui/dist/assets/index-CrKMmO__.js +0 -10
- package/src/console/ui/dist/assets/panel-access-C0J2D-a2.js +0 -64
- package/src/console/ui/dist/assets/panel-clock-DjGGFPzr.js +0 -1
- package/src/console/ui/dist/assets/panel-flows-DlCU5zjA.js +0 -45
- package/src/console/ui/dist/assets/panel-overview-BsFvDdts.js +0 -1
- package/src/console/ui/dist/assets/panel-runs-C0gmnoYL.js +0 -1
- package/src/console/ui/dist/assets/panel-traces-BDiAuVSK.js +0 -1
- package/src/drivers/vault-infisical.ts +0 -57
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Basic Usage
|
|
3
|
-
description: Scaffold the standard starter,
|
|
3
|
+
description: Scaffold the standard starter, call the health Flow, and inspect it in the Console.
|
|
4
4
|
source: packages/create-oke/template
|
|
5
5
|
icon: SquareTerminal
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Write your first Flow, call it from a typed client, and prove it with
|
|
9
|
+
`bun:test` — using the same standard starter `create-oke` scaffolds.
|
|
10
|
+
|
|
11
|
+
<Callout title="The one rule">
|
|
12
|
+
All reads, writes, emits, sends, and external calls belong behind `fx`. That is what makes effects
|
|
13
|
+
inspectable and tests deterministic.
|
|
14
|
+
</Callout>
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
<Steps>
|
|
19
|
+
|
|
20
|
+
<Step>
|
|
21
|
+
### Scaffold and run
|
|
9
22
|
|
|
10
23
|
```bash title="Terminal"
|
|
11
24
|
bunx create-oke@latest my-app
|
|
@@ -13,31 +26,21 @@ cd my-app
|
|
|
13
26
|
oke dev
|
|
14
27
|
```
|
|
15
28
|
|
|
16
|
-
|
|
29
|
+
<Surfaces />
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
</Step>
|
|
19
32
|
|
|
20
|
-
|
|
33
|
+
<Step>
|
|
34
|
+
### Read the health Flow
|
|
21
35
|
|
|
22
|
-
|
|
23
|
-
on(Trigger) → Effects
|
|
24
|
-
```
|
|
36
|
+
The standard starter already exports a health Flow:
|
|
25
37
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
3. **`do`** — the body; world access goes only through `fx`
|
|
29
|
-
4. **Effects** — inferred from the `fx` calls
|
|
30
|
-
|
|
31
|
-
## Your first Flow
|
|
32
|
-
|
|
33
|
-
The standard starter includes a health Flow:
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { on, flow, http } from "okengine";
|
|
38
|
+
```typescript title="flows/main"
|
|
39
|
+
import { on, flow, http, gate } from "okengine";
|
|
37
40
|
import { z } from "zod";
|
|
38
41
|
|
|
39
42
|
export const health = on(
|
|
40
|
-
http.get("/health"),
|
|
43
|
+
http.get("/health").gate(gate.public),
|
|
41
44
|
flow({
|
|
42
45
|
out: z.object({ ok: z.literal(true) }),
|
|
43
46
|
do: () => ({ ok: true as const }),
|
|
@@ -45,57 +48,66 @@ export const health = on(
|
|
|
45
48
|
);
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
Change the route or output and save. App and Console update together from the
|
|
52
|
+
same Manifest.
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
All reads, writes, emits, sends, and external calls belong behind `fx`. This is what makes effects
|
|
53
|
-
inspectable and tests deterministic.
|
|
54
|
-
</Callout>
|
|
54
|
+
</Step>
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
<Step>
|
|
57
|
+
### Call it from a typed client
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
Adopted modules become namespaces on the client:
|
|
59
60
|
|
|
60
|
-
```typescript
|
|
61
|
+
```typescript title="app"
|
|
61
62
|
import { oke } from "okengine";
|
|
62
63
|
import * as main from "./flows/main";
|
|
63
64
|
|
|
64
|
-
export const app = oke({ name: "
|
|
65
|
+
export const app = oke({ name: "standard" }).adopt({ main });
|
|
65
66
|
export type App = typeof app;
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
a method.
|
|
70
|
-
|
|
71
|
-
## Typed client
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
69
|
+
```typescript title="client"
|
|
74
70
|
import { createClient } from "okengine/client";
|
|
75
|
-
import type { App } from "
|
|
71
|
+
import type { App } from "./app";
|
|
76
72
|
|
|
77
73
|
const api = createClient<App>("http://localhost:6530");
|
|
78
74
|
const { data, error } = await api.main.health({});
|
|
79
75
|
```
|
|
80
76
|
|
|
81
|
-
`data` and `error` are inferred from the Flow contracts
|
|
82
|
-
schema
|
|
77
|
+
`data` and `error` are inferred from the Flow contracts — no separate client
|
|
78
|
+
schema. Bearer: `auth: { getToken, refresh }` (`okengine/client/auth` helpers;
|
|
79
|
+
`useSession` in `okengine/client-react`). Full options: [Client](/docs/reference/client).
|
|
80
|
+
|
|
81
|
+
</Step>
|
|
82
|
+
|
|
83
|
+
</Steps>
|
|
84
|
+
|
|
85
|
+
## Mental model
|
|
86
|
+
|
|
87
|
+
Every backend behavior has one shape:
|
|
88
|
+
|
|
89
|
+
<FlowShape />
|
|
90
|
+
|
|
91
|
+
## From Flow to client
|
|
92
|
+
|
|
93
|
+
Export → adopt → call or test. Same App type — no separate codegen project.
|
|
94
|
+
|
|
95
|
+
<ClientLoop />
|
|
83
96
|
|
|
84
97
|
## Test
|
|
85
98
|
|
|
86
|
-
|
|
99
|
+
Boot the same app with test drivers:
|
|
87
100
|
|
|
88
|
-
```typescript
|
|
101
|
+
```typescript title="tests/standard.test.ts"
|
|
89
102
|
import { expect, test } from "bun:test";
|
|
90
103
|
import { createTestApp } from "okengine/test";
|
|
91
104
|
import { app } from "../src/app";
|
|
92
105
|
|
|
93
|
-
test("health", async () => {
|
|
106
|
+
test("boots — health flow", async () => {
|
|
94
107
|
const t = await createTestApp(app);
|
|
95
108
|
const { data, error } = await t.api.main.health({});
|
|
96
109
|
expect(error).toBeNull();
|
|
97
110
|
expect(data).toEqual({ ok: true });
|
|
98
|
-
await app.stop();
|
|
99
111
|
});
|
|
100
112
|
```
|
|
101
113
|
|
|
@@ -103,6 +115,30 @@ test("health", async () => {
|
|
|
103
115
|
bun test
|
|
104
116
|
```
|
|
105
117
|
|
|
118
|
+
## Troubleshooting
|
|
119
|
+
|
|
120
|
+
<Accordions>
|
|
121
|
+
|
|
122
|
+
<Accordion title="api.main.health is not a function / type error">
|
|
123
|
+
Confirm the Flow is `export`ed from the module you `.adopt({main})`, and that `createClient` is
|
|
124
|
+
typed with your `App` type. Restart `oke dev` after renaming exports so the Manifest refreshes.
|
|
125
|
+
</Accordion>
|
|
126
|
+
|
|
127
|
+
<Accordion title="createTestApp fails to boot">
|
|
128
|
+
The starter patches test env and stores on the app options. Keep the template's side-imports
|
|
129
|
+
(vault, gates, channels, core db) — removing them can leave Vault or Store unresolved under test
|
|
130
|
+
drivers.
|
|
131
|
+
</Accordion>
|
|
132
|
+
|
|
133
|
+
</Accordions>
|
|
134
|
+
|
|
135
|
+
## Learn more
|
|
136
|
+
|
|
137
|
+
- [Flow](/docs/elements/flow) — triggers, contracts, effects, and composition
|
|
138
|
+
- [Store](/docs/elements/store) — SQL, KV, files, index
|
|
139
|
+
- [fx](/docs/reference/fx) — the full effect surface
|
|
140
|
+
- [Console · Overview](/docs/console/overview) — Manifest-derived panels
|
|
141
|
+
|
|
106
142
|
## Next
|
|
107
143
|
|
|
108
144
|
<Cards>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Get Started"
|
|
3
|
+
description: "From the one law to a running app — introduction, why OKE, install, and first flows."
|
|
4
|
+
icon: "Rocket"
|
|
5
|
+
source: "docs/spec/unified-theory.md"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Learn the shape once, install on Bun, then write your first Flow from the standard starter.
|
|
9
|
+
|
|
10
|
+
## Pages
|
|
11
|
+
|
|
12
|
+
<Cards>
|
|
13
|
+
<Card
|
|
14
|
+
title="Introduction"
|
|
15
|
+
description="One law, eight elements, ten exports."
|
|
16
|
+
href="/docs/get-started/introduction"
|
|
17
|
+
/>
|
|
18
|
+
<Card
|
|
19
|
+
title="Why OKE"
|
|
20
|
+
description="Six seams every backend maintains by hand."
|
|
21
|
+
href="/docs/get-started/why"
|
|
22
|
+
/>
|
|
23
|
+
<Card
|
|
24
|
+
title="Installation"
|
|
25
|
+
description="Scaffold with create-oke and open the Console."
|
|
26
|
+
href="/docs/get-started/installation"
|
|
27
|
+
/>
|
|
28
|
+
<Card
|
|
29
|
+
title="Basic Usage"
|
|
30
|
+
description="Health Flow, typed client, Console proof."
|
|
31
|
+
href="/docs/get-started/basic-usage"
|
|
32
|
+
/>
|
|
33
|
+
</Cards>
|
|
@@ -5,31 +5,43 @@ source: README.md
|
|
|
5
5
|
icon: Download
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
This page gets you from zero to a running app
|
|
8
|
+
This page gets you from zero to a running app on Bun. The engine targets
|
|
9
|
+
**Bun ≥ 1.3** — prefer it for install, scaffold, and `oke dev`.
|
|
10
|
+
|
|
11
|
+
<Callout title="The one rule">
|
|
12
|
+
Prefer `bun add okengine` when you want the `oke` CLI on your PATH. JSR (`@omqkhafi/okengine`) is
|
|
13
|
+
the library API only.
|
|
14
|
+
</Callout>
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
9
17
|
|
|
10
18
|
<Steps>
|
|
11
19
|
|
|
20
|
+
<Step>
|
|
12
21
|
### Prerequisites
|
|
13
22
|
|
|
14
23
|
- [Bun](https://bun.sh) ≥ 1.3 (`bun --version`)
|
|
15
24
|
- A terminal and a code editor
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
</Step>
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
<Step>
|
|
29
|
+
### Install the package
|
|
20
30
|
|
|
21
31
|
```bash title="Terminal"
|
|
22
32
|
bun add okengine
|
|
23
33
|
```
|
|
24
34
|
|
|
25
|
-
|
|
26
|
-
Library API only: `bunx jsr add @omqkhafi/okengine`. Prefer npm / `bun add` when you want the
|
|
27
|
-
`oke` CLI on your PATH via the package.
|
|
28
|
-
</Callout>
|
|
35
|
+
Library-only via JSR:
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
```bash title="Terminal"
|
|
38
|
+
bunx jsr add @omqkhafi/okengine
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</Step>
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
<Step>
|
|
44
|
+
### Scaffold with create-oke
|
|
33
45
|
|
|
34
46
|
```bash title="Terminal"
|
|
35
47
|
bunx create-oke@latest my-app
|
|
@@ -37,74 +49,114 @@ bunx create-oke@latest my-app --template standard
|
|
|
37
49
|
bunx create-oke@latest my-app --sql postgres
|
|
38
50
|
```
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
`standard` is the only starter. Default: local SQLite, Docker/production
|
|
53
|
+
Postgres. `--sql postgres` pins `store.sql` for **local, Docker, and
|
|
54
|
+
production** — schema stays dialect-agnostic (`store.schema.table`).
|
|
55
|
+
|
|
56
|
+
</Step>
|
|
43
57
|
|
|
44
|
-
|
|
58
|
+
<Step>
|
|
59
|
+
### Run and verify
|
|
45
60
|
|
|
46
61
|
```bash title="Terminal"
|
|
47
62
|
cd my-app
|
|
48
63
|
oke dev
|
|
49
64
|
```
|
|
50
65
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
Three ports come up together (mnemonic: **O·K·E = 6·5·3**):
|
|
67
|
+
|
|
68
|
+
<Surfaces />
|
|
69
|
+
|
|
70
|
+
Open `http://localhost:6533`. If the Console lists your flows, the install
|
|
71
|
+
worked — **derived, not configured.**
|
|
72
|
+
|
|
73
|
+
</Step>
|
|
74
|
+
|
|
75
|
+
</Steps>
|
|
76
|
+
|
|
77
|
+
## Local database sync
|
|
78
|
+
|
|
79
|
+
Local mode watches schema paths and auto-runs `oke db push` so the database
|
|
80
|
+
stays in sync. Opt out with `oke dev --no-db-push` or
|
|
81
|
+
`db: { autoPush: false }` in `oke.config.ts`.
|
|
82
|
+
|
|
83
|
+
For production, generate and apply migrations deliberately — never automatic on
|
|
84
|
+
boot:
|
|
55
85
|
|
|
56
86
|
```bash title="Terminal"
|
|
57
87
|
oke db generate # write drizzle/*.sql
|
|
58
|
-
oke db migrate # apply
|
|
88
|
+
oke db migrate # apply
|
|
59
89
|
```
|
|
60
90
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
| Port | Surface |
|
|
64
|
-
| ------- | -------- |
|
|
65
|
-
| `:6530` | Your app |
|
|
66
|
-
| `:6533` | Console |
|
|
67
|
-
| `:6535` | MCP |
|
|
68
|
-
|
|
69
|
-
Open the Console — flows, contracts, effects, and an architecture diagram are already there. **Derived, not configured.**
|
|
91
|
+
## Docker mode
|
|
70
92
|
|
|
71
93
|
Want Postgres/Redis like production while the app stays on host Bun?
|
|
72
94
|
|
|
95
|
+
<DevModes />
|
|
96
|
+
|
|
73
97
|
```bash title="Terminal"
|
|
74
98
|
oke dev --docker # or: oke dev -d
|
|
75
99
|
# or set the saved default: oke mode docker
|
|
76
100
|
```
|
|
77
101
|
|
|
78
|
-
|
|
102
|
+
Uses the `docker` driver profile in `oke.config.ts` (filled from `prod` when
|
|
103
|
+
omitted). Compose and credentials land under `docker/` (`.env.docker` beside
|
|
104
|
+
compose); host ports are unique per project.
|
|
79
105
|
|
|
80
|
-
|
|
106
|
+
Bare `oke dev` prompts once on a TTY (saved in `.oke/mode`); non-TTY defaults
|
|
107
|
+
to `local`.
|
|
81
108
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
| Protocol | Env shape (generated) |
|
|
110
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| Postgres | `DATABASE_URL` plus `OKE_STORE_SQL_*` |
|
|
112
|
+
| Redis | `REDIS_URL` plus `OKE_STORE_KV_PASSWORD` |
|
|
113
|
+
| S3-compatible files | `S3_ENDPOINT`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_BUCKET`, `S3_URL`, `S3_REGION`, `S3_CONSOLE_URL` |
|
|
114
|
+
| SMTP email | `SMTP_URL`, `SMTP_HOST`, `SMTP_PORT`, `MAILPIT_UI_URL`, optional `SMTP_USER` / `SMTP_PASSWORD` |
|
|
86
115
|
|
|
87
|
-
Each section also includes commented controls (
|
|
88
|
-
|
|
89
|
-
|
|
116
|
+
Each section also includes commented controls (Redis memory policy, Postgres
|
|
117
|
+
init options, Bun S3 session tokens, Mailpit limits). Uncommented supported
|
|
118
|
+
controls are preserved when `oke dev --docker` regenerates the file.
|
|
90
119
|
|
|
91
|
-
|
|
120
|
+
## Troubleshooting
|
|
92
121
|
|
|
93
|
-
|
|
122
|
+
<Accordions>
|
|
94
123
|
|
|
95
|
-
|
|
124
|
+
<Accordion title="oke: command not found after install">
|
|
125
|
+
Use `bun add okengine` (npm package), not JSR alone — the CLI ships with the npm distribution. Or
|
|
126
|
+
invoke via `bunx oke dev` from the project.
|
|
127
|
+
</Accordion>
|
|
128
|
+
|
|
129
|
+
<Accordion title="Console is empty / no flows listed">
|
|
130
|
+
Confirm `oke dev` is running and you opened `:6533`, not `:6530`. Flows appear only after the app
|
|
131
|
+
boots and the Manifest is extracted — fix TypeScript errors in the terminal first.
|
|
132
|
+
</Accordion>
|
|
133
|
+
|
|
134
|
+
<Accordion title="Database out of sync after editing schema">
|
|
135
|
+
Local `oke dev` auto-pushes by default. If you passed `--no-db-push` or set `db.autoPush: false`,
|
|
136
|
+
run `oke db push` yourself, or re-enable auto-push.
|
|
137
|
+
</Accordion>
|
|
96
138
|
|
|
97
|
-
|
|
139
|
+
</Accordions>
|
|
98
140
|
|
|
99
|
-
|
|
100
|
-
|
|
141
|
+
## Learn more
|
|
142
|
+
|
|
143
|
+
- [CLI Reference](/docs/reference/cli) — `oke`, `create-oke`, mode, and db commands
|
|
144
|
+
- [Environment variables](/docs/reference/environment-variables) — protocol-shaped env
|
|
145
|
+
- [Configuration](/docs/reference/configuration) — `oke.config.ts` drivers and `db.autoPush`
|
|
146
|
+
|
|
147
|
+
## Next
|
|
101
148
|
|
|
102
149
|
<Cards>
|
|
103
150
|
<Card
|
|
104
151
|
title="Basic Usage"
|
|
105
|
-
description="
|
|
152
|
+
description="Health Flow, typed client, and bun:test."
|
|
106
153
|
href="/docs/get-started/basic-usage"
|
|
107
154
|
/>
|
|
155
|
+
<Card
|
|
156
|
+
title="Introduction"
|
|
157
|
+
description="The one law, eight elements, ten exports."
|
|
158
|
+
href="/docs/get-started/introduction"
|
|
159
|
+
/>
|
|
108
160
|
<Card
|
|
109
161
|
title="CLI Reference"
|
|
110
162
|
description="oke and create-oke commands."
|