Elements
Gate
permission to act — Auth, session, ABAC, rate limits, quotas, and feature flags sit at the trigger — permission to act before effects run.
Gate is the element for permission to act.
Auth, session, ABAC, rate limits, quotas, and feature flags sit at the trigger — permission to act before effects run.
Governing rule
Permission sits at the trigger. Auth is built-in (hybrid session, argon2id) with zero-config defaults.
At a glance
Gate
Essence: permission to act. Replaces: auth · session · ABAC · rate limit · quota · feature flag.
Drivers available
auth
Built-in hybrid session; alternatives via protocol adapters.
rate limit
Default `sliding-window-counter`.
ABAC · flags
Permission, quota, and feature-flag gates.
Example from the teaching apps
Claimed fence from linkly — same source the doc-drift gate checks:
examples/linkly/src/gates.ts
import { gate } from "okengine";
export const member = gate.policy("member", ({ auth }) => !!auth?.verified);
export const fair = gate.rate({
strategy: "sliding-window-counter", // near-exact, two keys, no boundary bursts
max: 60, per: "1m", keyBy: "ip",
});