Skip to content

Configuration

Variables, secrets and bindings for the engine and web Workers, and the local dev files.

Both Workers are configured in their wrangler.jsonc. After changing one, regenerate its binding types: pnpm --filter @orderloop/engine types or pnpm --filter @orderloop/web types.

Set in vars in apps/engine/wrangler.jsonc.

Variable Default Meaning
AI_MODEL @cf/meta/llama-3.3-70b-instruct-fp8-fast Workers AI text model for every structured AI call (JSON mode)
AI_GATEWAY_ID "" AI Gateway id for caching, rate limits and logs. Empty calls Workers AI directly
AI_MODE live live calls the model; mock uses the deterministic heuristics only (tests, offline dev)
TIME_SCALE 1440 Divides every wait and timeout, so 1440 turns a day into a minute. Use "1" in production
INTAKE_MAILBOXES "" Email intake: JSON object of mailbox local part to flow id. Empty uses orders@ and po@ → tpl-b2b-order, purchasing@ → tpl-purchase-request
INTAKE_REQUIRE_AUTH true "false" accepts mail without a passing DMARC, DKIM or SPF result. Never in production
INTAKE_REPLY true "false" turns off the acknowledgement reply to accepted email

Set with pnpm --filter @orderloop/engine exec wrangler secret put <NAME>.

Secret Meaning
INTAKE_ALLOWLIST Extra senders allowed to start orders by email: addresses or @domains, comma-separated. Customers’ own addresses and company domains are always allowed. See Email intake

Set with pnpm --filter @orderloop/web exec wrangler secret put <NAME>, or in apps/web/.dev.vars for local dev (copy apps/web/.dev.vars.example).

Secret Meaning
APP_PASSWORD A break-glass operator: sign in with no email and this password (an HttpOnly cookie, 30 days), or send it as Authorization: Bearer <APP_PASSWORD>. When set, sign-in is required even before anyone is added. With it unset and no people in users, the dashboard and API are open; see Team and roles
WEBHOOK_SECRET Enables signed inbound events at POST /api/v1/webhooks/events. Unset answers 503 there

Outbound webhook subscriptions each have their own secret, generated when the subscription is created; they are not configuration.

Binding Worker Resource
DB engine, web D1 database orderloop; migrations in packages/db/migrations
DOCS engine, web R2 bucket orderloop-docs: invoices, POs and inbound documents
ORDER_AGENT engine Durable Object OrderAgent (SQLite-backed), one per order
ORDER_LOOP engine Workflow orderloop-order (class OrderLoop), up to 10,000 steps per instance
REPLENISH engine Workflow orderloop-replenish (class Replenish), scheduled 0 6 * * *
AI engine Workers AI
ENGINE web Service binding to orderloop-engine, entrypoint EngineApi

The web Worker serves orderloop.io as a custom domain; change routes in apps/web/wrangler.jsonc for your own. The engine has no routes, no workers.dev URL and no preview URLs: only the web app’s service binding reaches it, plus Email Routing rules that send mail to it (see Email intake). The docs Worker (apps/docs/wrangler.jsonc) serves docs.orderloop.io.

Both app Workers answer GET /health with { ok: true, service }.