Installation
Install okengine, scaffold an app with create-oke, and open the Console.
This page gets you from zero to a running app. Prefer Bun throughout — the engine targets Bun ≥ 1.3.
Prerequisites
- Bun ≥ 1.3 (
bun --version) - A terminal and a code editor
Install the package
Add the framework (ships the oke CLI):
bun add okengineJSR
Library API only: bunx jsr add @omqkhafi/okengine. Prefer npm / bun add when you want the
oke CLI on your PATH via the package.
Scaffold with create-oke
Create the standard recommended project layout:
bunx create-oke@latest my-app
bunx create-oke@latest my-app --template standard
bunx create-oke@latest my-app --sql postgresThe standard template is the only starter. --sql postgres opts into a
pgTable schema and pins local, Docker, and production to Postgres; the default
keeps local SQLite with Docker and production on Postgres.
Run the app
cd my-app
oke devLocal mode watches domain schema paths (schema.ts / schema.decl.ts / app.ts)
and auto-runs oke db push (drizzle-kit) so the database stays in sync. Opt out
with oke dev --no-db-push or db: { autoPush: false } in oke.config.ts. For
production, generate and apply migrations deliberately:
oke db generate # write drizzle/*.sql
oke db migrate # apply — never automatic on bootThree ports come up together (mnemonic: O·K·E = 6·5·3):
| Port | Surface |
|---|---|
:6530 | Your app |
:6533 | Console |
:6535 | MCP |
Open the Console — flows, contracts, effects, and an architecture diagram are already there. Derived, not configured.
Want Postgres/Redis like production while the app stays on host Bun?
oke dev --docker # or: oke dev -d
# or set the saved default: oke mode dockerThat uses the docker driver profile in oke.config.ts (filled from prod when omitted). Compose files and credentials land under docker/ (.env.docker beside compose). Host ports — including Mailpit UI / RustFS console extras — are unique per project so multiple apps can run at once. Bare oke dev prompts once on a TTY (saved in .oke/mode); non-TTY defaults to local.
The generated env follows each protocol instead of forcing one generic credential shape:
- Postgres:
DATABASE_URLplusOKE_STORE_SQL_* - Redis:
REDIS_URLplusOKE_STORE_KV_PASSWORD - S3-compatible files:
S3_ENDPOINT,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY,S3_BUCKET,S3_URL,S3_REGION, andS3_CONSOLE_URL - SMTP email:
SMTP_URL,SMTP_HOST,SMTP_PORT, andMAILPIT_UI_URLwith optionalSMTP_USER/SMTP_PASSWORD
Each section also includes commented controls (for example Redis memory policy,
Postgres init options, Bun S3 session tokens, and Mailpit limits). Uncommented
supported controls are preserved when oke dev --docker regenerates the file.
Verify the install
Hit the app (path depends on the template) or open http://localhost:6533. If the Console lists your flows, the install worked.
Next steps
Continue to Basic Usage for your first Flow, typed client, and test.