Documentation
A new programming model for backends. One law. Eight elements. One contract.
Welcome to the OKEngine handbook. Keep the model small; let the backend grow without growing the mental model.
The Law
Every backend behavior is a Flow: on(Trigger) → Effects. One species; triggers are typed values.
on(http.post(), createBooking); // path + name from the file tree
on(expireStaleClock, expireStale);
on(orderPlaced, sendReceipt);01 Understand
Master the mental model before exploring features:
The Architecture
Why backends drift apart, the one rule that stops it, and the five pieces behind every Flow.
Try It
From an empty folder to a Flow running in the Console — one sitting, minimal detour.
02 Elements
Deep primitives and execution law:
Elements
Flow, Signal, Store, Clock, Gate, Vault, Channel, AI.
Reference
CLI, configuration, fx, errors, security, and plugins.
AI Resources
Runtime MCP (:6535), docs MCP (:6536), agent skills, and machine-readable docs.
03 Extend
Connect to infrastructure and extend the model:
Plugins
Official extensions that add capabilities without creating a ninth element.
Providers
Managed cloud infrastructure behind protocol-named drivers.
Recipes
Self-hosted Docker compose recipes for SQL, KV, search, and local AI.
04 Client
Call your Flows from a browser, CLI, or another service — typed, zero separate codegen:
Overview
createClient, envelopes as values, and how Client relates to the eight elements.
Calling
REST vs RPC, options, result helpers, resources, and remote types.
Auth
Bearer sessions, refresh once on 401, and gate denials as values.
Live
api.live SSE, resume, and live resource queries.
React
useSession, useLive, and useLiveQuery from okengine/client-react.