# Building and shipping on Whisk Conventions version 1. This is the document a coding agent reads before touching a Whisk app. Every file it refers to is published beside it at `https://skill.whisk.run/`: `whisk.schema.json`, `graph.schema.json`, `headers.md`, `environment.md`, `webhook-presets.yaml`, `errors.md`, `doctor-rules.md`. Working starter apps come with the CLI (`whisk init --template`). ## Quick start The person wants something live they can open, so get them an address first and build after. Do these in order, before writing any of their app: 1. Install the CLI if `whisk` is not on the PATH: `curl -fsSL https://github.com/Whisk-Hosting/cli/releases/latest/download/install.sh | sh` (Windows in §3). If it says its folder is not on your PATH, run `whisk` by the full path it prints. 2. `whisk login --agent ""`. Show the person the link and code at once, while they are still watching, then run the `whisk login --resume` command it prints. 3. In an empty folder named for the app (the name becomes its address): `whisk init --template ts` (or `py`, `go`, `next`, `astro`). If it prints `FREE_APP_TAKEN` or `PLAN_LIMIT_APPS`, tell the person before going further. 4. `whisk deploy -m "Starter"`, about a minute, and give the person the address it prints. 5. Build what they asked for on top of the starter, deploying each piece as it works. Read §2 before writing code, and the sections below as the app needs them: sign-in §4, data §5, secrets §6, jobs §7, webhooks §8, files and email §9, failures §11. With existing code, skip the template and run `whisk init` in its folder (§3). ## 1. What Whisk is Whisk hosts websites, online shops, customer portals and internal tools written by coding agents. An app is a container that speaks HTTP; the platform adds login, a Postgres database, a queue with durable workflows, secrets, webhooks, storage, email and backups, all by convention rather than by SDK. Tenant apps live at `..whisk.page` on a paid plan, `--.whisk.page` on the free plan; the platform is at `whisk.run`. Use the hostname the API returns rather than building one. What you will do: `whisk login`, `whisk init`, `whisk doctor`, `whisk deploy`, then tell the human which secrets to set and where. The human's part is a few screens in the dashboard. Yours is everything else, and one more thing: whenever Whisk gets in your way, tell us with `whisk feedback` (section 12). You are the user Whisk is built for, so your feedback is how it gets better. ### Whisk already does this Use the built-in. Do not add an outside service, SDK account or library for any of these unless the human asks for that service by name; if a built-in falls short, say so with `whisk feedback` (§12) rather than working around it. | Need | Whisk's built-in | Instead of | |---|---|---| | Sign-in, users, roles | the platform's login and `X-Whisk-*` headers (§4) | Auth0, Clerk, NextAuth, Supabase Auth, a password page | | Database and backups | Postgres per app, `DATABASE_URL`, backups and restore points (§5) | Supabase, Neon, Firebase, SQLite files | | Scheduled and background work | functions, steps, retries, approvals (§7) | node-cron, Celery, BullMQ, an outside cron, Zapier | | Secrets | declared names, set in the dashboard (§6) | `.env` files, Doppler, Vault | | Incoming webhooks | `webhooks:` with verification, retries, replay (§8) | a relay service, your own signature code | | Receiving email | `inbox:`, an address per app, delivered like a webhook (§8) | SES receiving, Mailgun routes, Postmark inbound, an IMAP poller | | Files and uploads | `storage: true` (§9) | an S3 or R2 account, Cloudinary, UploadThing | | Video and audio | `` (§9) | Mux, Vimeo, YouTube embeds | | Email | `email: true` (§9) | SendGrid, Resend, Mailgun, SMTP | | Push notifications | `/.whisk/push.js` and `…/push/send` (§9) | OneSignal, Firebase Cloud Messaging, Pusher Beams, the `web-push` package | | Cache, counters, locks | `kv: true` (§9) | Upstash, Redis Cloud | | Errors | `SENTRY_DSN`, Whisk's own error store, `whisk errors` (§3) | a Sentry account, Bugsnag, Rollbar | | Logs and request tracing | stdout, `X-Whisk-Request-Id`, `whisk logs`, OpenTelemetry traces to `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, `whisk traces` (§2, §11) | Datadog, Logtail, LogRocket, Honeycomb, an APM agent | | Analytics | ``, `whisk analytics` (§3) | Google Analytics, Plausible, PostHog, Mixpanel, a tracking pixel | | Bot protection | `routes.challenge` (§4) | reCAPTCHA, hCaptcha, Turnstile | | Hosting, HTTPS, domains, caching | the platform (§3) | Vercel, Cloudflare, a CDN | ### One app or two To the people you work for, an app is one tool their team uses in a web browser, with its own web address, its own data and its own list of who can use it. Size is not a reason to split: a whole CRM with many screens is one app. When asked for something new, decide whether it belongs in an existing app or is a new one: - Same people, same information: add it to the existing app. A report on the CRM's customers belongs in the CRM. - Different people should see it (a client portal beside the staff tools): a new app, because access is set per app. - Something they would switch off, roll back or hand to someone else on its own: a new app. - Someone else maintains it: a new app, so their changes do not collide with yours. - Needing the other app's data is not a reason to merge: use a shared database (§5). Reuse the key the business already holds for a service rather than asking for a new one (§6). Say which you chose and why in one sentence. When the rules do not settle it, ask the human. ## 2. The rules An app on Whisk is a stateless HTTP server in a container. 1. Listen on `PORT` (always 8080) on all interfaces. 2. Answer `GET ` with 200 when ready to serve. Default `/health`. 3. Log to stdout and stderr. JSON lines are indexed by field; plain lines are indexed as text. 4. Write files only under `/tmp`. Everything else is read-only. `/tmp` is emptied on every restart; files that must last go to storage (§9, files a job keeps). `/tmp` is memory: what you keep there and what the process uses share `WHISK_MEMORY_BYTES` (256 MiB on Free), and a run that goes over is killed without SIGTERM. 5. Exit cleanly on SIGTERM within the grace period (default 28 seconds). A deploy sends new requests to the new version at once and sends SIGTERM to the old one only once the requests it already holds have finished, or after 15 minutes. 6. Read configuration and secrets from the environment. Never from files in the repository. 7. Trust identity only from the `X-Whisk-*` headers, which only the platform can set. 8. Treat every queue delivery and webhook as possibly repeated; use the provided IDs to dedupe. 9. Start fast. Under five seconds from process start to health 200 is the target, because sleeping apps wake on demand. **Limits.** Every plan's limits are in one table at https://whisk.run/usage: memory, processor, storage, database connections, workflow runs, email, requests, domains and outbound traffic. Read it before building anything that has to grow, and design inside it. **Keep it light.** Memory is what an app costs to run, and a small app wakes fast and is never killed for running out. Stream large files and query results in chunks (storage reads, CSV and spreadsheet parsing, database cursors) instead of loading them whole into memory or `/tmp`. Process a big job as many small steps, each handling one batch. Let the database filter, sort and total rather than fetching every row to do it in code. React to an event or webhook when something changes instead of a schedule that checks every few minutes, and choose the longest schedule the business can live with. Load heavy libraries only in the code path that needs them. Pages and API reads that can be a little old should send `Cache-Control: private, max-age=` (`public` for a page anyone may see): the edge answers repeat requests from its cache, per person and for up to an hour, without waking the app. A response that sets a cookie is never cached. **Live updates.** Server-sent events and WebSockets work on every plan and address, sign-in included; prefer server-sent events when only the server talks. Writes reach the visitor at once and nothing times a stream out, so send a heartbeat every 30 seconds (`:` on an event stream, a ping on a WebSocket) to keep phone networks and proxies from dropping it. An open stream keeps the app awake by itself. Streams close on every deploy (close them on SIGTERM) and now and then when Whisk updates its servers, so every client reconnects with backoff: give events an `id:` and resume from `Last-Event-ID`, and keep what a stream reports in the database or key-value store so a reconnect misses nothing. Close a stream after an hour or so: the sign-in is checked when it opens, and the reconnect checks it again. ## 3. Getting an app live If `whisk` is not on the PATH, install it first; neither script needs root: ``` curl -fsSL https://github.com/Whisk-Hosting/cli/releases/latest/download/install.sh | sh # linux, macOS irm https://github.com/Whisk-Hosting/cli/releases/latest/download/install.ps1 | iex # windows PowerShell powershell -NoProfile -Command "irm https://github.com/Whisk-Hosting/cli/releases/latest/download/install.ps1 | iex" # windows Git Bash or cmd ``` Each command runs in a fresh shell for most agents, so an `export PATH` does not last: when the script says its folder is not on your PATH, run `whisk` by the full path it prints. If `whisk` is already installed, run `whisk update` once at the start of a session: this document describes the CLI the platform serves, and an older one lacks commands it names. Later, any `--json` output that carries `cli_update`, or an `UNKNOWN_COMMAND` error, means the same: run `whisk update` and retry. ``` whisk login --agent "" name yourself as people know you ("Claude Code", "Codex", "Cursor"): the approval page, deploys and token lists show it. Exits 2 at once with a URL and a code in the NEEDS_HUMAN block (also under --json): show both to the human, then run the resume command it names (whisk login --resume ), which waits for approval. The token works only from this computer: use it through whisk, never copy it elsewhere whisk init --template ts|py|go|next|astro|shop writes whisk.yaml, .whisk/app.json, and the template; next and astro are Next.js and Astro; shop is a whole online shop (on Whisk's commerce engine) for a business selling to the public, and runs only as a Promoted app whisk doctor checks the repository; exit 3 means fix the listed problems whisk deploy -m "…" commits, pushes, builds, migrates, health-checks, switches traffic whisk logs -f tails the app whisk clone / copies an existing app's code here; git pull and push then work ``` If `whisk login --resume` is cut off by your shell's time limit, run it again: the code stays good until it expires and the waiting key is kept. **Following and recovering.** These are the commands to reach for when something takes a while or goes wrong: ``` whisk deploy --no-wait -m "…" prints the deploy id at once; a deploy can take up to 25 minutes whisk deploys info its status and phase; deploys cancel stops a stuck one whisk deploys log its whole build log and, for a failed start, the app's last lines whisk status running, sleeping or broken, and why it stopped answering whisk whoami · whisk orgs who you are and which businesses this token reaches whisk use / binds this folder to an app (the NOT_FOUND fix names it) whisk secrets list declared names, set or unset; never values whisk functions list declared functions, their triggers and drift from the code whisk events send --data @event.json sends an event to test an event function whisk runs show · whisk runs replay · whisk runs cancel whisk restore show --wait follows a restore (whisk restore list lists them) ``` Every command takes `--org ` and `--app ` instead of `.whisk/app.json`, and `--quiet` to drop progress lines. In CI, where nobody can approve a login, a person runs `whisk agent-token create --label "ci"` and puts the token in `WHISK_TOKEN`. Run `whisk login` in the app's folder, or with `--org` (and `--app`): the approval page then starts on that app or business, the narrowest login that fits. The person can choose all their businesses instead; that login acts as them in every business they belong to, including ones they join later: `whisk orgs` lists them and `--org ` picks one when the folder names none. A computer has one sign-in: do not pass `--profile` to make another, and do not try other profiles to find a business. When the business you need is missing, run `whisk whoami`: under "Not in this login" (`not_in_login` with `--json`) it names each of the person's businesses the login does not cover, with the link where the person adds it. When a command meets one, it exits 2 with a NEEDS_HUMAN block whose link (`details.url`, `details.reason` `BUSINESS_NOT_IN_LOGIN`) is the same page. Show the person the link, then run the command again. Do not run `whisk login` again for it. A business `whoami` does not name is one the person is not in: ask them to join it or to have an owner invite them. A person adds a new business themselves at `https://whisk.run/new`. If you speak MCP rather than a shell, run `whisk mcp` as a stdio server: this document and every error code are its resources, every command is a tool. In a chat with no shell, such as ChatGPT or Claude, the person connects Whisk's assistant connector (`https://api.whisk.run/mcp`) and signs in once. Its tools cover deploying (`deploy_app` takes the files themselves), rolling back, logs, runs (and replaying one), the database's tables and queries, access and feedback; `whisk_build_guide` names which command each one stands for and what a chat cannot do (cron runs on demand, webhook deliveries, errors and traces, restores, previews, domains, export), which needs the dashboard or a developer with the CLI. Every command takes `--json`. Exit codes: 0 success; 1 an error, including a refused request such as a bad slug or uncommitted files (`INVALID_REQUEST`), read `code` and `fix`; 2 needs a human, show them the printed URL and wait; 3 doctor or the manifest found problems, fix the listed ones and retry; 4 not signed in or not allowed: read `code` (for `AUTH_REQUIRED` or `TOKEN_EXPIRED` run `whisk login`; for `AGENT_CATEGORY`, `AGENT_PAUSED`, `FORBIDDEN_ROLE` or `TOKEN_SCOPE` logging in again does nothing, so tell the human what to grant or resume); 5 network or Whisk's side, retry with backoff and do not change the code; 6 deploy failed in the app, read the log excerpt. Start from a template unless the human already has code: `whisk init --template ts` (Hono, Drizzle), `--template py` (FastAPI, SQLAlchemy, Alembic), `--template go` (chi, pgx, goose). Each is a plain starter (a notes page, a health route, one event function; a few hundred lines, the Go one about 900) that passes doctor with zero warnings, deploys with nothing for a person to set, and shows the conventions below working. `whisk init --template` works in a folder holding only dot-files and `CLAUDE.md` or `AGENTS.md`. Existing code deploys too: `whisk init` in its folder writes `whisk.yaml` for it, carrying across what its previous host's Procfile, `app.json`, `render.yaml`, `railway.json`, `railway.toml` or `fly.toml` says (migrate step, workers, health path, Dockerfile, secret names, settings) and listing at the top what is left to do by hand. Keep what the app already does for itself (its own sign-in and job queue on a Promoted app, its payment provider) and move what Whisk does for it: files to storage, mail to `email: true`, scheduled commands to functions, backups to Whisk's. Then make it follow the rules and run doctor. **Errors and traces.** Wire both in before the first deploy, in every app, whatever it is built with. They are how you and the human find out what broke and what is slow once real people use the app: `whisk errors` and the Errors page list its exceptions, grouped, with the stack; `whisk traces` and the Traces page list every request with the edge's timing, and the app's own spans show where inside the app each request's time went: its queries, its calls out. The platform sets `SENTRY_DSN` and the `OTEL_*` variables (`environment.md`) in every deployed container, so all the app does is start a Sentry SDK and an OpenTelemetry SDK when they are set. `whisk dev` sets neither, so nothing is sent while you work. The templates already do this. Until an app does, `whisk doctor` warns (`W140`, `W141`) and `whisk deploy` says "Not set up: errors and traces." Without an SDK, the stacks the app prints (a Node error and its frames, a Python traceback, a Go panic) still reach the Errors page from its logs, but without the request, the user, or the exceptions a framework catches and answers 500 for without printing. Any Node server (Express, Fastify, Hono, Koa, Astro, SvelteKit, React Router, Remix, Nuxt) loads one file before the app. Install `@sentry/node @opentelemetry/sdk-node @opentelemetry/instrumentation-http @opentelemetry/instrumentation-undici @opentelemetry/instrumentation-pg`, write `instrument.mjs`, and start the server with `node --import ./instrument.mjs ` in the Dockerfile's `CMD` or the `start` script: ```js import * as Sentry from "@sentry/node"; import { NodeSDK } from "@opentelemetry/sdk-node"; import { HttpInstrumentation } from "@opentelemetry/instrumentation-http"; import { UndiciInstrumentation } from "@opentelemetry/instrumentation-undici"; import { PgInstrumentation } from "@opentelemetry/instrumentation-pg"; if (process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) { const sdk = new NodeSDK({ instrumentations: [ new HttpInstrumentation({ ignoreIncomingRequestHook: (req) => req.url === "/health" }), new UndiciInstrumentation(), // fetch new PgInstrumentation(), // pg, and Drizzle or Kysely over pg ], }); sdk.start(); process.once("SIGTERM", () => sdk.shutdown().finally(() => process.exit(0))); } if (process.env.SENTRY_DSN) { Sentry.init({ dsn: process.env.SENTRY_DSN, environment: process.env.WHISK_ENV }); } ``` The SDK reads the endpoint, the token and the app's name from the `OTEL_*` variables itself, and the HTTP instrumentation continues the edge's `traceparent`, so each request's trace id is its request id. Leave out `@opentelemetry/auto-instrumentations-node`: it loads dozens of instrumentations and slows every start. Sentry 11 reports errors and leaves tracing to the SDK above; leave its `enableOpenTelemetrySetup` off. Next.js: put the same code in `instrumentation.node.ts` (without the `SIGTERM` line, and without the HTTP instrumentation, since Next.js traces each request itself) and add `instrumentation.ts` at the project root, or in `src/`. A new app can start from `whisk init --template next` or `--template astro`, which have both wired. ```ts export async function register() { if (process.env.NEXT_RUNTIME === "nodejs") await import("./instrumentation.node"); } export async function onRequestError(err: unknown, request: { headers: Record }) { const Sentry = await import("@sentry/node"); Sentry.captureException(err, { tags: { request_id: String(request.headers["x-whisk-request-id"] ?? "") } }); } ``` Frameworks catch errors themselves and answer 500, so tell Sentry about them where the framework hands them over, tagged with the request's `X-Whisk-Request-Id` as `request_id` so the error links to its trace: | Framework | Where | |---|---| | Express | `Sentry.setupExpressErrorHandler(app)` after the routes | | Fastify | `Sentry.setupFastifyErrorHandler(app)` | | Koa | `Sentry.setupKoaErrorHandler(app)` | | Hono | `app.onError((err, c) => { Sentry.captureException(err); … })` | | SvelteKit | `handleError` in `src/hooks.server.ts` | | Astro | a middleware: `try { return await next() } catch (e) { Sentry.captureException(e); throw e }` | | React Router, Remix | `export function handleError(error)` in `entry.server` | | Nuxt | a Nitro plugin: `nitroApp.hooks.hook("error", (e) => Sentry.captureException(e))` | Python: add `sentry-sdk`, `opentelemetry-sdk`, `opentelemetry-exporter-otlp-proto-http` and the framework's instrumentation (`opentelemetry-instrumentation-fastapi`, `-django` or `-flask`), then where the app is made: ```python import os, sentry_sdk from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor if os.environ.get("SENTRY_DSN"): sentry_sdk.init(dsn=os.environ["SENTRY_DSN"], environment=os.environ.get("WHISK_ENV")) if os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"): provider = TracerProvider() provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter())) trace.set_tracer_provider(provider) FastAPIInstrumentor.instrument_app(app, exclude_spans=["receive", "send"]) ``` Go: `sentry.Init(sentry.ClientOptions{Dsn: os.Getenv("SENTRY_DSN")})` when it is set, and when `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is set, `otlptracehttp.New(ctx)` as the exporter of `sdktrace.NewTracerProvider(sdktrace.WithBatcher(exp))`, `otel.SetTracerProvider`, `otel.SetTextMapPropagator(propagation.TraceContext{})`, and the router wrapped in `otelhttp.NewHandler`. The Go template's `whisk.go` (`startTracing`, `traceRequests`, `traceQueries`) is the whole of it, database queries included, to copy. **Everything `whisk.yaml` takes.** Unknown keys are errors; `whisk schema` prints the JSON schema. Settings marked paid are refused with `PLAN_FEATURE` on the free app, except `kv`, which deploys without a cache and a `W080` line instead (§9). Storage, email and customer identity are on every plan, the free app included, within its allowances. ```yaml whisk: 1 # required name: job-tracker # required; the app's address derives from it title: Job board # what people call it, two to four plain words description: Every open job, who is on it and what is due this week. # one sentence, 120 at most category: Jobs # the group the business's home lists it under routes: public: ["/", "/health"] # everything else needs a signed-in person (§4) challenge: ["/contact"] # public POSTs here need a solved bot challenge (§4) csrf_off: [] # rare: routes exempt from the CSRF check, for embeds device_header: X-Device-Id # optional: your own clients' install header, rate limited per install (§4) headers: { X-Frame-Options: DENY } # add or override response headers health: { path: /health, timeout: 30 } # seconds from start to the first 200; default 90 database: app # app | shared: | none (§5) migrate: "node dist/migrate.js" # runs before traffic switches, at most 600 seconds (§5) build: dockerfile: Dockerfile # optional; the stack is detected without one secrets: [NPM_TOKEN] # available only while building, never at run time secrets: [XERO_CLIENT_SECRET] # names only (§6) env: { LOG_LEVEL: info } # plain configuration, visible in logs queue: { endpoint: /.whisk/inngest } functions: [] # cron and event functions (§7) webhooks: [] # incoming webhooks (§8) inbox: { handler: /inbound/email } # receive email at the app's own address (§8) static: # committed folders served by the edge, cached for a year - { dir: public/assets, path: /assets } redirects: # old addresses the edge redirects, before the app wakes - { from: /about-us, to: /about } # 301 unless status says otherwise redirects_file: redirects.txt # more rules, one a line: from to [status] [query=drop] storage: false # files, uploads, images, video (§9) · every plan kv: false # a Redis of its own (§9) · paid kv_evict: true # false for a job queue: a full cache refuses writes (§9) email: false # sending email (§9) · every plan always_on: false # never sleeps · paid promoted: false # runs only as a Promoted app (§4) · paid b2b: false # the shop template's trade ordering, beside promoted: true (§4) · paid commerce: medusa # the shop template's own setting: keep it in a shop made from it (§4) content: payload # the site and shop templates' own setting: keep it (§4) workers: [] # an existing app's own job processes, beside promoted: true (§4) · paid calls: [] # other apps of the business this one calls (§8) accepted_callers: [] # other apps of the business that may call this one (§8) customer_identity: none # none | app | org: the app's own users (§4) · every plan sign_in: { logo: brand/logo.png, colour: "#0b6e4f" } # customers' sign-in look (§4) · app pool network: public # the only value, the same as leaving it out: apps are public previews: { database: empty, ttl_days: 3 } # previews start empty; days a preview lasts ``` `static` folders are read from the commit, not from the built image: a folder the commit does not hold, such as git-ignored build output like `dist/`, fails the deploy with `MANIFEST_INVALID` naming it (`whisk doctor` warns first, `W004`). Serve build output from the app itself, or commit the folder. Static files never wake the app and are cached for a year, so give them content-hashed names. `always_on` is for apps that must answer at once. People can also switch it on the app's page in the dashboard, which commits the change to whisk.yaml and deploys it, so pull before you push again. An open WebSocket or event stream keeps an app awake by itself, and everything else should sleep. A sleeping app has 60 seconds to answer its health check when a visitor wakes it, whatever `health.timeout` allows a deploy, so an app that needs longer sets `always_on` (`W005`). A sleeping app starts again on its next request, so start fast: the TypeScript template bundles each entry point into one file with esbuild (`build.mjs`), so its image holds no `node_modules` and Node reads a few files instead of thousands. A package that must stay a file on disk (a native addon, or one that reads its own files at run time) goes in esbuild's `external` list, and the Dockerfile copies it into the image. A preview starts with an empty database of its own; seed what testing needs from a migration or a script, never from production. **Settings apply in seconds.** When a push changes only `whisk.yaml` since the live deploy and leaves `build`, `env`, the `static` folders and `b2b` as they were, Whisk skips the build and runs the live image with the new settings: routes and who can visit, `always_on`, `health`, secrets and the rest. It goes live in the time a deploy takes. Commit a settings change on its own to get this, and tell the human it applies straight away. A route made public still waits for a person to allow it. **Describe the app.** The business's home lists every app by its `title`, `description` and `category`, so set all three in whisk.yaml before the first deploy. People open apps from the home, and most of them never see the code. The title is what the people who use the app would call it, in two to four plain words: "Job board", never "jobtrackr-v2". The description is one sentence of at most 120 characters for someone who uses the app, starting with what they do in it: "Log your hours each day and send them for approval on Friday." Leave out the app's name, technical words, the stack, and words like "powerful" or "AI-powered". The category is the group it sits in, such as Sales or Jobs. Reuse one the business already has: `whisk doctor` lists them (`W160`). When the app changes what it is for, change the description in the same commit. An owner can change all three on the home, and what they set stays, so doctor tells you when your values are no longer the ones shown. **Say what changed.** Every deploy shows the subject line of its commit to the business, on the app's Deploys page and in `whisk deploys list`. Write it for the people who use the app, in one plain sentence about what they will notice: `whisk deploy -m "Add a CSV export to the jobs page"`, not "fix bug", "wip" or "whisk deploy". `-m` commits uncommitted changes with that message; when you commit yourself, the first line of your commit message is what shows. Keep it under 72 characters and leave file names and internals out. `whisk deploy` from `main` or `master` deploys production, and nothing else does. From any other branch it starts a preview at its own URL, says so, and leaves production alone; to put a branch live, merge it into `main` and run `whisk deploy` from `main` (`PRODUCTION_NEEDS_MAIN` otherwise). Work on `main` unless the human asks to try something out first. Check `environment` in the `--json` summary before telling the human something is live. A plain `git push` of a branch only stores it: start its preview with `whisk envs start ` when someone needs to see it, and from then on every push to that branch updates it. Each app may have one preview on the free app and three on a paid plan (`PLAN_LIMIT_PREVIEWS`); remove one you are done with using `whisk envs delete preview:`. Previews sleep when idle and go a few days after their last push or visit. A preview runs no scheduled functions, workflows or events (`PREVIEW_NO_WORKFLOWS`); skip sending events when `WHISK_ENV` starts with `preview:`, and test functions with `whisk dev`. `whisk apps delete [...]` (or `/`) prints one link where a person deletes them all in one step; show it to them. A deleted app keeps its data for 7 days, and `whisk apps deleted` then `whisk apps restore ` bring it back stopped. **Several people on one app.** Other people and their agents may be changing the same app while you work. Start from the latest code: in a copy made by `whisk clone`, run `git pull --rebase whisk main` before you change anything (plain git is signed in there). If someone pushes while you are working, `whisk deploy` fetches their commits and rebases yours on top when that goes cleanly, then pushes; the `--json` summary has `caught_up` when it did, so run the tests again before you tell the human it is done. When it cannot, you get `PUSH_BEHIND` and your copy is left as it was: run the `git rebase` or `git merge` its fix names, resolve each file in `details.conflicts` so both changes still work, run the tests, and deploy again. For a bigger change, work on a branch and show it on a preview, so nobody else's work is in the way until it is merged into `main`. Never force-push to Whisk: it deletes the other person's work. `whisk deploy` ends with the URL, the address of each declared webhook, and any `warnings`: a deploy that went live with something wrong, such as `FUNCTIONS_NOT_REGISTERED` (a function name in `whisk.yaml` the code does not use), whose fix says what to change. If declared secrets (`build.secrets` included) have no value yet it also prints a `NEEDS_HUMAN` block naming them and the dashboard URL. Relay that block to the human verbatim. Do not ask them for the values; the app restarts on its own when they are set. Some changes are the business's to allow, not yours. A production deploy waits with `GRANT_NEEDED` (exit 2, a `NEEDS_HUMAN` block) when, compared with the live app, it calls another app, adds a webhook, makes a route public, drops a route's challenge or CSRF check, or changes `customer_identity`; when it names a business secret this app is not on the list of, or a key another app of the business holds (§6); or when a connection needs a grant. The block names each change in a plain sentence and gives one link where an owner or admin approves them all with one tap. Relay it verbatim and say plainly what each change lets the app do; never try to approve it yourself. The first deploy, a deploy that widens nothing and a deploy the same as one approved before do not wait, and previews never do. **Their own domain.** On a paid plan, `whisk domains add jobs.acme.com` prints two DNS records for the human to create: a TXT that proves they own the name and a CNAME to the app's address. A bare domain (`acme.com`) cannot have a CNAME. If the human's DNS host offers an ALIAS or ANAME record, or CNAME flattening (Cloudflare flattens a CNAME at the domain itself), point it that way at the `apex_target` printed, the app's address: it then goes through the app's CDN while that is on. Otherwise it takes A (and AAAA) records to the addresses printed, which reach the app directly and never through the CDN; to have the site on the CDN anyway, make `www.acme.com` the main address (below). Relay the records with their HOST, the name as a DNS provider's form takes it (`@` is the domain itself), changing the name's existing A record rather than adding a second one and leaving its MX and other TXT records alone. Then `whisk domains verify jobs.acme.com` once they are in place; until then it answers `DOMAIN_UNVERIFIED` naming what is missing. The certificate is issued on verification and the app answers on the name with no deploy. DNS cannot redirect `www.acme.com` to `acme.com`: add and verify both, then make one the main address (below). Prefer relative links; `WHISK_PUBLIC_URL` stays the platform address, and the `Host` header is the name the visitor used. **One main address.** Once the human's domain answers, ask them whether it should be the app's main address, and if so run `whisk domains main acme.com`. Every other address of the app (its Whisk address, `www.acme.com`, an old domain) then sends a browser to the same page on `acme.com` with a 301, so people and search engines see one site. Anything other than a page load, such as a webhook's POST, is still answered on the address it was sent to, so integrations set up with an old address keep working; point new ones at the main address. Previews keep their own addresses. A domain becomes the main address only once its certificate is issued, and the Whisk address takes over again by itself if the domain stops working. `whisk domains main` prints the main address and `whisk domains main --whisk` makes the Whisk address the main one again; a human can press Make main on the app's domains page. To put every app on the business's domain at once (crm.acme.com, billing.acme.com, and each new app with no further DNS), an owner or admin's session runs `whisk domains business add acme.com` instead: a TXT and one wildcard CNAME (`*.acme.com`), then `whisk domains business verify`. The human's existing records (www, mail) keep working. **A new address.** The app's platform address is made from its slug. To change it, run `whisk apps rename ` on the same app: never create a new app and delete the old one. The app keeps its data, secrets, history and domains, the old address sends visitors to the new one, and the old slug still names the app. Commit the `.whisk/app.json` and `whisk.yaml` it updates. The name people see is the app's display name, which starts as its slug: `whisk apps display-name "Job Tracker"` sets it and leaves the address as it is. **Redirects.** When a page is renamed or a site moves to Whisk, keep every old address working, or search engines drop the pages. List each old path under `redirects` with the new one (`from`, `to`, `status` 301 by default, 308, 302, 307 or 410 for a page that is gone). `from: /blog/*` with `to: /news/*` moves a whole section, carrying the rest of the path; `from: /blog/:year/:slug` with `to: /posts/:slug` reshapes addresses; `from: /product.php?id=12` matches only that query. Short links and campaigns are rules too (`/go/zoom` to an outside address, status 302 when it will change). The request's query is kept unless `query: drop`, or the rule's `from` names one. More than a few dozen rules go in a file named by `redirects_file`, one rule a line: `/old-page /new-page`, `/blog/* /news/* 308`, `/old-promo 410`; at most 10,000 rules in all. The edge answers them on every hostname of the app without waking it, ahead of the app's own routes. Point each rule straight at the final address: `whisk redirects check` (and `whisk doctor`, `W111`) reports a rule whose target another rule redirects again, and a loop fails the push. `whisk redirects test /old-page` prints what a request gets, and `whisk redirects list` what is live. To move the old domain itself, add it to the app (`whisk domains add old-acme.com`, verify it), then `whisk domains redirect old-acme.com acme.com`: every request to the old name gets a 301 to the same path on the new one, and a path a rule names goes straight to the rule's target there. A human can also set it on the app's domains page in the dashboard. To send `www.acme.com` and every other address to `acme.com`, make `acme.com` the main address instead (above). **Their customers' domains.** An app that serves other businesses under their own names (a white-label app) lets each bring a domain of its own from inside the app, with no person running the CLI: the template's `domains` helper (`domains.add`, `list`, `verify`, `remove`; Go `domains.Add` and so on) calls `/v1/orgs//apps//domains` with `WHISK_SERVICE_TOKEN` from production. `add(hostname)` answers the domain with its `id`, `status` and `records`; show the customer `records` as they are (a TXT, then a CNAME, or A and AAAA records for a bare domain like `lab.com`) and store the `id` with the customer. Let them press a button that calls `verify(id)` once they have created the records: `DOMAIN_UNVERIFIED` says in `details.missing` what is not in place yet, and DNS can take an hour, so never verify in a loop. `status` is then `pending_certificate` until the certificate is served and `active` after; the app answers on the name with no deploy and reads the name the visitor used from `Host`. Remove with `remove(id)`, never by hostname. The app removes only the domains it added; the business's own (`added_by: team`) answer `DOMAIN_ADDED_BY_TEAM`. A name another app holds is `DOMAIN_TAKEN`, one app holds at most the plan's `custom_domains_per_app` (`PLAN_LIMIT_DOMAINS`), and more than 30 adds and removes or 120 verifies an hour is `RATE_LIMITED`. Only the customer's own admins should reach these screens: check their role in the app first. `whisk dev` answers the same routes; names under `.test` or `.example` verify there at once. **Serving from near the visitors.** On Team and Business, `whisk cdn on` puts the app's address and its CNAME'd domains behind a CDN (`whisk cdn` shows the status and each hostname's route). It helps public pages, sites and downloads. A public page is cached only as long as the app's `Cache-Control` says, so set it on public pages and assets you want cached; a response that sets a cookie is never cached. Each production deploy empties the cache. To show a change sooner, the app drops the pages it changed: `POST /v1/orgs//apps//cdn/purge` with `WHISK_SERVICE_TOKEN` and `{"paths": ["/entries/42", "/entries/*"]}` (a trailing `*` takes everything under it, at most 20 paths, `{}` for everything), or `whisk cdn purge` by hand. Then a public page can carry a long max-age and still change at once. An app the CDN does not serve answers `"on": false`, and so does `whisk dev`, so purging on every change is safe anywhere. **Looking after a live app.** `whisk status` says whether it is running, sleeping or broken, which deploy is live and which secrets are unset, and, when it stopped answering, why: the exit code and last lines of a crash, or a wake that failed. `whisk rollback` puts the previous deploy back (or a named one from `whisk deploys list`). `whisk errors` lists the app's grouped exceptions and `whisk traces` shows where its requests' time went, once the app sends them (§3, "Errors and traces"). `SENTRY_DSN` points at Whisk's own error store: initialise the Sentry SDK with only the DSN, without Sentry's tracing, profiling or session replay, which cost memory and start time and which Whisk already covers. A log line's `request_id` opens its trace. Traces are kept 7 days, 100,000 spans per app per day. `whisk open ` prints the dashboard link for the human (`logs`, `runs`, `secrets`, `domains`, `access`, `errors`, `analytics`). `whisk github` shows the app's optional two-way copy on the business's GitHub; a person links it in the app's settings. **Analytics.** Every app has analytics on every plan. Put `` in the `` of every page layout (the templates do), and each page view is counted. The script and what it sends stay on the app's own address, it sets no cookie and keeps no IP address. The business's own people signed in to the app are left out (`analytics: { team: count }` in whisk.yaml counts them), and so is a browser asking not to be tracked (`analytics: { do_not_track: ignore }` counts it). Send an event from the page with `umami.track("signup", { plan: "team" })` (check `window.umami` first, since a blocker can stop the script), or mark a button with `data-umami-event="signup"`. Crawlers run no script, so Whisk counts them from its own request log: search engines, AI assistants and crawlers, link previews and other bots, with nothing to add to the app. `whisk analytics` prints views, visitors, top pages, sources, events and crawlers over `--period 24h|7d|30d|90d` or `--from 2026-11-01 --to 2026-11-07`. `--source google.com`, `--page /pricing` and `--event signup` narrow it to those visits, and `--by` breaks it down by `day` (or `hour`, `month`, with `--tz`), `page`, `entry`, `exit`, `source`, `event`, `event-property` (the properties `--event` carried), `country`, `browser`, `os` or `device`. `whisk analytics visitors` lists the visitors and `whisk analytics visitor ` what one did, page by page. `whisk analytics traffic --by day,path,agent` counts every request, robots, scripts and what the CDN answered from its copy included, grouped by any of its parts (`query`, `user_agent`, `referer`, `user_id`, `address`, `country`, `network`, `edge_cache`, `hour`…) and narrowed with `--status 404`, `--kind ai_crawler`, `--country NZ` or `--user-id `; `--list` prints the latest requests one by one, with the time the app and a wake took, and `--json` every field. `whisk analytics crawlers [--crawler Googlebot]` prints each crawler's pages, answers and journeys, and `whisk analytics journey ` one journey request by request; the human sees everything with `whisk open analytics`. Visits are kept 7 days on Free, 13 months on paid plans and 25 months on Business. If the app has a privacy notice, say there that it counts visits with Whisk's analytics, without cookies, and for how long. Do not add another analytics tool unless the human names one. **Known vulnerabilities in packages (Business plan).** Whisk checks the live app's packages after every production deploy and daily: the image (base image packages and everything installed in it) and every lockfile in the commit. `whisk status` says how many findings need fixing now; `whisk doctor` lists them as `W063`, one line per package: it checks the local lockfiles as they are, before you deploy, so run it after each change and the list shrinks as you fix; `whisk scan` lists each one with its severity, the installed version, the version that fixes it (`fixed`) and where it was found (a lockfile, or a path in the image). Fix the critical and high ones that have a fix: move the package to that version or newer in the lockfile (a base image package by moving to a newer base image), deploy, then `whisk scan --now` to check again. A finding with no `fixed` has no fix yet; leave it. `whisk doctor` also sums up the person's other apps (where they are an owner, admin or developer) that have packages to upgrade, under `other_apps`; `whisk scan --all` lists each of those apps with its packages and fixed versions. Tell your human about them, and fix them in each app's own repository. For Go, Whisk also checks whether the app's code calls the vulnerable part: a finding with `reach: not_called` is listed apart under "Not called by your code" and is not counted as one to fix now; update it when convenient, never ahead of the ones to fix. Every other language is `unknown` and counts as called. Python's slim image ships pip, which bundles its own copies of urllib3, msgpack and setuptools that the scan reports; the Python template uninstalls pip after `uv sync`, since the app runs from uv's virtualenv, and an app with its own Dockerfile does the same. Most image findings come from the operating system in a full base image: the TypeScript and Go templates run on a distroless image (`gcr.io/distroless/nodejs24-debian13:nonroot` for Node, the Python one on `python:3.14-slim`), which has no shell or package manager, so keep `migrate` a plain command such as `node dist/migrate.js`, not `npm run` or shell syntax (`whisk doctor` warns, `W062`). An app that needs a system program (ffmpeg, ImageMagick, a browser) moves the Dockerfile's last stage to `FROM node:24-trixie-slim`, installs it with `RUN apt-get update && apt-get install -y --no-install-recommends && rm -rf /var/lib/apt/lists/*`, and sets `USER node` and `CMD ["node", "dist/index.js"]`, since only the distroless image starts node itself. A slim image has no CA certificates, so add `ca-certificates` to that install whenever a build step or the app makes HTTPS calls (a postinstall download, a `fetch` at start), or they fail with a certificate error. Deploys are never blocked by findings. On another plan `whisk scan` says scanning is on the Business plan. ## 4. Identity The platform signs people in. Your app never sees a password, a token or a login form. On every request, read who it is from headers (full table in `headers.md`): | Header | Meaning | |---|---| | `X-Whisk-Audience` | `anonymous`, `team`, `customer` or `service` | | `X-Whisk-User-Id` | stable ULID; store this, never the email, as the key | | `X-Whisk-Email`, `X-Whisk-Name` | verified email; display name (may be empty) | | `X-Whisk-Org` | org ULID | | `X-Whisk-Groups` | comma-separated group names (team only) | | `X-Whisk-Roles` | comma-separated org roles: `owner`, `admin`, `developer`, `billing`, `member`, plus `guest` (team only) | | `X-Whisk-Flags` | comma-separated feature flags on for this person, when any is (below) | | `X-Whisk-Request-Id` | trace ID; put it in every log line | | `X-Whisk-Country` | the visitor's country, `NZ`, when the edge knows it; a hint, not proof | Routes are private unless listed under `routes.public` in the manifest. A private route only ever receives requests with a `team` or `customer` identity (or `service`, for platform deliveries and app-to-app calls); the platform has already redirected browsers to login and answered API clients 401. A public route receives `anonymous` when nobody is signed in and the full identity when someone is. Someone not signed in is rate limited by their network address, which an office shares. When the app's own clients (a desktop or phone install that signs its requests itself) call public routes, have each send a header naming its install and list it as `routes.device_header` (for example `X-Device-Id`): each install then has its own allowance, and the installs at one address together have ten times it. The edge does not check the header, so the app still authenticates every request. Authorise inside the app by role or group: ```ts const roles = (c.req.header("X-Whisk-Roles") ?? "").split(",").filter(Boolean); if (!roles.includes("admin") && !roles.includes("owner")) return c.text("Forbidden", 403); ``` Never read identity from a cookie, a query parameter, a body, or an `Authorization` header a browser sent; the headers are the only source and the platform strips any copy arriving from the internet. To sign someone out, redirect to `/.whisk/logout?return=/`. To force login from a public page, redirect to `/.whisk/login?return=`. Both are handled in front of the app. **Using an app as your person.** To change what lives in a deployed app (its pages, records, settings), call the app's own API rather than writing to its database: `whisk call GET /cms/api/pages?limit=5`, `whisk call PATCH /cms/api/pages/4 --data @page.json`. It sends the request to the app's address with your Whisk credential, so you never put the token in a request yourself; prefer it to curl. The edge lets you in as the person you act for, with their grants, and adds `X-Whisk-Agent` (your name) and `X-Whisk-Agent-Id`; the app records the change as theirs, made by you. An answer outside 2xx is `CALL_FAILED` with the app's answer in `details.body`. When the person you act for is an owner of the app's business, your `whisk login` works as it is: `whisk call` signs each request on this computer, and the call is recorded in the business's audit log like any agent's. For anyone else (an admin, a member) the edge refuses a login with `TOKEN_SCOPE`, and you need an agent token: an agent identity's credential, which needs `change` to write, or one from `whisk agent-token create`, which needs `deploy`, as `WHISK_TOKEN`. In the site and shop templates the pages are at `/cms/api`. For many requests (an import, a bulk change), write one JSON request per line, `{"method", "path", "data"}`, and send them with `whisk call --batch file.ndjson --parallel 4`: one run, one connection, an answer per line. Keep `--parallel 1` when a line needs an earlier one made first. `customer` identities are the app's own users (portals, public apps), enabled with `customer_identity: app | org`. They arrive in the same headers without roles or groups, and `X-Whisk-User-Id` names the customer. The way in is an invitation until an owner opens registration; onboard your own with `POST /v1/orgs//apps//customers {email, name}` and your service token, which answers the link (201) and emails nothing; someone already in the pool answers 200 with them. To have Whisk email someone their invitation, `POST .../customers//invite` (once a day per person at most, `CUSTOMER_INVITE_SENT`, counted as your app's email). Only send one when the owner or the person asked for it, never on a schedule or for a whole list. `whisk customers list`, `invite` (with `--email` to send it), `block` and `unblock` do the same from the CLI. An owner can remove a customer: they are signed out and can no longer sign in. Invited again (or signing up again) within 30 days they come back under the same `X-Whisk-User-Id`, so keep their records rather than deleting them when a request stops naming them; after 30 days the platform deletes the person, and a later invitation makes a new id. Customers sign in on Whisk's pages in the app's display name (set it with `whisk apps display-name`, or the pages say its slug), with a password, an emailed code or a passkey. Give them a way out: link `/.whisk/account` (their own page, with their password, passkeys and Sign out) somewhere a signed-in customer sees it, or `/.whisk/logout?return=/` (W132). With `customer_identity: app`, `sign_in` in `whisk.yaml` makes those pages and the sign-in emails look like the app: `logo` (a PNG or JPEG in the repository, at most 100 KB), `colour`, `background`, `text`, `font` (`whisk`, `system` or `serif`) and `corners` (`square`, `rounded`, `pill`). A logo takes the name's place at the top, so use one that carries the name. Match the app's own design, keep text and background readable (W131), and leave the "Secured by Whisk" band alone: it is not the app's to style. **Promoted apps.** An app a business sells to its own customers can be made a Promoted app by an owner in the dashboard (`promoted.in_force` on `GET /v1/orgs//apps/`): it never sleeps, has 4 GB of memory that is always there for it and at least two processor cores (the plan's, when it gives more), and is served first when its server is busy. Never ask for promotion to get round anything in this skill, and never promote an app yourself: it is charged, so it is the owner's choice. An app that cannot run any other way says `promoted: true` in whisk.yaml: its production deploy then waits, `blocked` with `PROMOTED_APP_REQUIRED`, until an owner promotes it, and goes live by itself after; relay the NEEDS_HUMAN block. Previews of it run with a Promoted app's memory without waiting. Everything else in this skill still applies. A Promoted app is where an existing product brings what it already has: - **Its own sign-in.** List every route under `routes.public` (`["/**"]`) and the app's own login decides who gets in; doctor leaves out W090 for it. The edge then limits each address as it would one signed-in person (600 requests a minute, 3000 on Business); every request counts, the files the app serves itself included, so keep a cold load (a service worker's precache too) well under that. Build or keep a login of the app's own only on a Promoted app. - **Its own job processes.** `workers` runs up to ten long-running commands beside the web process, in the same container and memory, one copy of each, restarted when it exits: ```yaml workers: - name: jobs # WHISK_WORKER=jobs; its log lines start [worker:jobs] command: bundle exec sidekiq - name: queue command: node dist/worker.js database: direct # DATABASE_URL is a session connection: LISTEN, advisory # locks and SET work; at most 3 open across the workers ``` Use it to bring a queue an app already has across unchanged (graphile-worker, pg-boss, Sidekiq, Oban, Celery, Que, GoodJob); Procfile `worker:` lines map onto it, and `release:` onto `migrate`. Size each library's own pool to the three direct connections. Whisk shows a worker's logs, restarts and memory, and does not see inside its jobs: no run history, replay or failure alerts. New background work is written as functions (§7) on every app. - **A shop's setup.** A shop made from the shop template goes live closed for orders (`SHOP_NOT_READY`) until the business has given who is emailed each order and each enquiry, a way to be paid, delivery options with prices and its name. Right after its first deploy, and whenever its checkout is closed, read `whisk call GET /admin/whisk/setup` and walk the person through each item not done, one at a time, in their words: each has a `fix` and `steps`, from signing up for Stripe to pasting its keys on the secrets page. Ask for the details and send them with `whisk call POST /admin/whisk/setup --data '{"orders_email": "…"}'`; recommend the rest (GST number, phone, address, policy pages, own domain and email) without holding up the launch. - **Trade ordering.** The shop template runs on any plan with room for it and keeps its own customer sign-in. Its trade ordering (companies, trade prices, paying on account, the ERP link) comes only with Promoted apps: `b2b: true` beside `promoted: true`, and a preview of an app not yet promoted fails with `B2B_UNAVAILABLE`. Its whisk.yaml says `commerce: medusa`: keep it, since Whisk's commerce engine answers its API (`/store`, `/admin`, `/auth`, `/hooks`, in Medusa's shape) and the app serves only its pages. The site and shop templates' whisk.yaml say `content: payload`: keep it, since Whisk's content engine answers their site editor (`/cms`) and its API (`/cms/api`, in Payload's shape). A page block of the site's own is a file, `content/blocks/.json`: `{"label": ..., "fields": [{"name", "type", "label", "default", ...}]}`, its types text, textarea, words, picture, check, number, select (with options), link, group and rows (with fields); `CONTENT_BLOCK_INVALID` says what is wrong with one. Who may open the app (groups, people, everyone in the business) and who is in the business are an owner's or admin's choice. Everyone in the business means its members. A guest, someone from outside such as a contractor, opens only the apps they are given and works on those alone, so invite one with `whisk members invite --guest --app `. `whisk access show` and `whisk members list` read them. When the person asks you to change them, `whisk access grant`/`revoke` and `whisk members invite`/`remove` do not change anything yourself: they print a link and exit 2 (`NEEDS_HUMAN`, with `details.request_id`). Show the person the link; they approve exactly that change on it, signed in, within 24 hours. `whisk requests show --wait` then waits for their answer and prints the result (an invite's link to send, for instance); a declined or expired request is `REQUEST_CLOSED`, and nothing changed. When the person is a developer, whose role cannot make that change, the request goes to the business's owners instead (`details.asked_of` is `owners`): they are emailed and have 7 days. Tell the person it is waiting on their owners; do not wait for it. The same holds for `whisk apps restore`. **Public pages.** The edge rejects a cross-site POST to the app (`CSRF_REJECTED`), so forms work from the app's own pages with no token. Put a public form that strangers fill in (contact, quote request, sign-up) under `routes.challenge`: a POST without a solved proof-of-work challenge gets `CHALLENGE_REQUIRED` carrying one; solve it with the Altcha widget and resend with the solution in the `altcha` form field. There is no difficulty to set: a person gets one a phone solves in about a second, and an address that keeps posting to the app gets harder ones (a larger `maxnumber`) until it slows down, so always solve the challenge the latest `CHALLENGE_REQUIRED` carries. `routes.headers` adds or replaces response headers on every route, such as a `Content-Security-Policy`. The edge sends `Cross-Origin-Opener-Policy: same-origin`, so a link to the app from inside a sandboxed iframe (a CRM tile, a widget on another site) opens to Chrome's `ERR_BLOCKED_BY_RESPONSE`; when the app is meant to be opened that way, set `Cross-Origin-Opener-Policy: unsafe-none` in `routes.headers`. **The Whisk bar.** When the app has an admin (a dashboard, a back office, a CMS), name it in whisk.yaml so the business's team gets a bar across the top of every page, like WordPress's toolbar, with `Admin` and `Edit page` links: ```yaml admin: path: /admin # the admin's address on this app edit: "/admin/edit?path={path}" # optional: opens the editor at the page with this path setup: /admin/setup # optional: what the app still needs from the business ``` `admin.path` and `admin.edit` are paths on the app's own address; `{path}` is the page's path, percent-encoded. The edge adds the bar to team members' pages only, signs them in quietly on public pages once they have signed in on the app's address, and never shows it to customers, guests or the public. Build the `admin.edit` route to check the person is on the team (or send them to `/.whisk/login?return=`), find what that path shows, and redirect to its edit screen, or to the list when nothing matches. An app with no admin leaves `admin` out and gets no bar. The site and shop templates already declare theirs. `admin.setup` names a route that answers `GET`, for a team member, with what the app still needs from the business before it works for its customers: `{"ready": false, "items": [{"key", "label", "required", "done", "fix", "steps"}]}`, `done` null for what the app cannot check itself. When an app needs the business's own details, accounts or choices to work (where emails go, how it is paid, its prices), keep them in the app, editable in its admin, and list them there rather than leaving a person to find them. `whisk deploy` prints each item not done once the deploy is live, required ones first, and the bar shows `Finish setup` beside `Admin` while a required one is missing. Walk the person through those items after a deploy. **An MCP server in the app.** When the person wants to use the app from Claude or ChatGPT, serve an MCP server (Streamable HTTP, one `POST` per JSON-RPC message) from the app and name it in whisk.yaml: ```yaml mcp: path: /mcp # where the MCP server answers; never under routes.public read_tools: [list_invoices, get_invoice] # the tools that only read ``` The person adds `https:///mcp` as a custom connector, and the platform does the sign-in: no OAuth, tokens or login code in the app. Each request arrives with the person's team headers and `X-Whisk-Agent` naming the assistant, so a tool answers and changes exactly what that person may, and records changes as theirs, made by it. Give every tool `annotations` with `readOnlyHint`, and list each read-only tool under `read_tools` too: an agent allowed only to read may call those and no other, and any tool not listed counts as a change. Keep the server stateless (answer each request on its own, ignore `Mcp-Session-Id`), because the app can sleep and restart between requests. ### Feature flags To ship a change to a few people first, declare a flag in whisk.yaml and read it from `X-Whisk-Flags` (Starter plan and up): ```yaml flags: new-checkout: remove_by: 2027-01-31 # a release flag: gone by this day payments-off: {kind: kill-switch} ``` ```ts const flags = new Set((c.req.header("X-Whisk-Flags") ?? "").split(",").filter(Boolean)); if (flags.has("new-checkout")) return newCheckout(c); return checkout(c); ``` Keep both sides working until the flag is on for everyone. The person decides who sees it, on the app's Flags page or with `whisk flags set new-checkout --team` (everyone on the team), `--people a@example.com`, `--groups beta`, `--percent 10`, then `whisk flags on new-checkout` for everyone and `whisk flags off new-checkout` to go back. None of it needs a deploy. Once a release flag is on for everyone, delete its off side and the flag in one change. A background job asks `GET $WHISK_FLAGS_URL?user=` with `WHISK_SERVICE_TOKEN` and gets `{"flags": [...]}`. Never keep a flag's rollout in code or the database; the platform holds it. ### Who may see and change what The platform decides who may open the app. The app decides which records each person may see and change, and that is where most real security holes in business apps are: one customer opening another's invoice by changing the number in the address. Do it the same way every time. 1. **Store the owner on every record a person creates**: their `X-Whisk-User-Id`, in a column such as `owner_id` or `author_id`. Never take the owner from the body, the query string or a hidden form field. 2. **Filter in the query, not afterwards.** The template's `whisk` module has `scopeFor` (`scope_for`, `ScopeFor` in Go): the business's team sees every record, a customer only their own, anyone else nothing. Every list, search, count, export and report goes through it. 3. **Check every record fetched by id** with `canSee`, then `canChange` before changing or deleting it (`can_see` and `can_change`; `CanSee` and `CanChange`). A record the person may not see answers 404, as if it did not exist; one they may see but not change answers 403. 4. **Change the rules in one place.** When a business wants something different (members see only their own records, a group sees a department's), change the helpers, not each route. The template's access tests (`access.test.ts`, `test_access.py`, `access_test.go`) check the rules over thousands of generated people and records; keep them passing and add a case for the new rule. 5. **Test each kind of record as the wrong person.** For every route that reads or changes one, add a test that calls it as a second customer, as a team member who is not an owner or admin, and with no identity at all, and expects 404, 403 or an empty list, never the record. Ids in the address and in the body both count. The same habits close the other common holes. Send SQL with parameters (the ORM, or `$1`), never by joining strings. Let the framework escape HTML; never insert text a person typed as raw HTML. Keep keys on the server, never in code sent to the browser. Fetch only addresses the app chose, never a URL a person typed without checking its host first. Keep uploads in storage (§9) and serve them from there. Before pushing, run the tests and `whisk doctor`: W094 warns when an app with customer sign-in never limits anything to the signed-in person, and W096 to W099 flag SQL built from text, raw HTML, a list of people's records with no owner filter, and public routes that write. ## 5. Database `DATABASE_URL` is a pooled Postgres connection in transaction mode. Use it as-is with any driver: its certificate verifies, Node's `pg` included. No session-level state: no `SET` outside a transaction, no advisory locks held across statements, no `LISTEN`. Prepared statements are fine inside a transaction. Before a migration relies on a function from a recent release (such as `uuidv7()`), check the server's version: `whisk db schema --json` prints it as `postgres`. Migrations run from the manifest's `migrate` command before traffic switches, with a direct connection the platform provides for that step and a snapshot taken first. The previous deploy stays live and keeps writing while the migration runs. A migration that runs longer than 600 seconds is stopped; split a long backfill into a function instead. A failed migration that changed no tables, columns, indexes or functions leaves the database as it is, so nothing users wrote is lost; one that did change them is rolled back to the snapshot, and the error names the replaced database, kept for 7 days, where anything users wrote meanwhile can be read back with `whisk db query --database`. So run each migration in one transaction (most tools do on Postgres), and keep migrations forward-only and idempotent where the tool allows. `whisk dev` also runs the `migrate` command on your own machine before it starts the app. `database: app` (default) gives the app its own database. `database: shared:` gives the app its own schema inside a database shared across the org, for apps that must join across each other. `database: none` for apps without one. When an app needs data another app of the business keeps, read it from there: a grant in the owning app's migration when both are on one shared database (below), or a call to the other app (§8). Prefer that to a new database or a copy of the data. In a shared database each app connects as its own role and owns one schema of the same name, `app_`, which is first on its `search_path`, so unqualified tables land there. Every schema is private to its app until that app grants access; nothing in `whisk.yaml` opens it. The owning app grants read access in one of its migrations, naming the reader's role (`whisk apps info --json` prints the reader's id as `app.id`; inside an app, `select current_user` names its own role): ```sql GRANT USAGE ON SCHEMA app_ TO app_; GRANT SELECT ON ALL TABLES IN SCHEMA app_ TO app_; ALTER DEFAULT PRIVILEGES IN SCHEMA app_ GRANT SELECT ON TABLES TO app_; ``` The first two cover the tables that exist; the third covers tables the owner creates later. The reader then queries `app_.` and joins it with its own tables. Grant `INSERT`, `UPDATE` or `DELETE` the same way only when the reader must write; `REVOKE` takes access back. **Row-level security: one customer never sees another's rows.** When the app serves customers (`customer_identity`), or people who must not see each other's records, every table holding rows that belong to someone gets a policy, so a query that forgets its `where` still answers only the caller's rows. Add it in a migration, naming the column that holds the owner's `X-Whisk-User-Id`: ```sql create index orders_owner_id on orders (owner_id); alter table orders enable row level security; alter table orders force row level security; create policy orders_by_audience on orders using ( current_setting('whisk.audience', true) in ('team', 'system') or owner_id = nullif(current_setting('whisk.user_id', true), '') ); ``` `force` matters: the app's role owns the table, and an owner skips policies without it. The policy lets the team and the app's own work see every row and a customer only their own. Then every query on such a table goes through the template's helper, which tells Postgres who is asking at the start of one short transaction: `dbFor(who(c), (tx) => …)` in TypeScript, `with db_for(identity(request.headers)) as session:` in Python, `db.For(ctx, callerOf(identityFrom(r.Header)), func(tx pgx.Tx) error {…})` in Go. Functions and webhook deliveries, which run for nobody in particular, use `asSystem` (`as_system`, `db.AsSystem`); never use it to answer a person's request. A query that skips the helper sees none of the rows and cannot write them, which is the safe way to fail. Keep slow work (calls to other services) outside the helper, since the transaction holds a pooled connection until it ends. To tailor it: a table every signed-in customer may read but only the team may change (a price list) needs no policy; a team member who should see only their own rows drops `'team'` from the list; rows shared by a customer's company use a column holding that company's id instead of the person's. A migration that reads or changes rows of a policy table starts with `select set_config('whisk.audience', 'system', true);` (DDL needs nothing). `whisk db query` runs as `system` and sees every row. Another app reading a shared schema is filtered by the owner's policies too: it sets `system` the same way when it should see every row. `whisk dev` connects as a superuser, which policies never filter, so prove isolation on a deploy. **Keep the app's own queries from changing the schema.** By default the app connects as the role that owns its tables, so a bug or an injected statement could turn row-level security off, drop a policy or rewrite a table. Set `database_role: restricted` and the app connects as a second login, `_run`, that owns nothing: it reads and writes rows, under every policy, and cannot change a table, a policy or anything else the migrations made. Only the `migrate` step connects as the owner. Use it for any app whose data is kept apart with row-level security, and for an app moving to Whisk that already runs as a restricted role. ```yaml database: app database_role: restricted # owner (default) | restricted; needs a migrate command migrate: "npx prisma migrate deploy" ``` - `DATABASE_URL` in the running app is the run login (pooled, as always); in `migrate` it is the owner (direct). Use each as-is. Prisma users point `url` at `DATABASE_URL` and need no `directUrl`: the migrate step's `DATABASE_URL` is already direct. - Every table, view and sequence the owner makes is readable and writable by the run login without a grant, now and later (`select`, `insert`, `update`, `delete`; `usage` and `update` on sequences). It has no `truncate`, cannot create anything, and cannot `set role` to the owner, so drop any `SET ROLE` or `SET LOCAL ROLE` the app used to switch to a restricted role itself: the login already is one. - Schema changes belong in `migrate` alone. An app that creates tables when it starts (`create table if not exists` at boot, `prisma migrate deploy` or `db push` in the start command) fails under the run login with `permission denied`; move that into `migrate`. `whisk doctor` warns (W105, W102). - Make a table append-only with policies, not with `revoke`: give it a `for select` and a `for insert` policy and no `update` or `delete` policy, and the run login can add rows and never change them. A `revoke` in a migration also works and lasts across deploys, but a restore that swaps the database in gives the run login its grants on every table again; policies are part of the schema and come back with it. - In a shared database, a reader that runs with `database_role: restricted` connects as `app__run`: grant that login what you grant `app_`, in the same three statements. It exists once the reader has deployed with the setting, and a grant to a login that does not exist fails, so add it after. - `whisk db query`, `db schema` and `db url` act as the owner, so a person can still inspect and repair anything. `whisk dev` connects as a superuser, so prove the restriction on a deploy. Turning it on for a live app takes one deploy: it makes the login, grants it everything the owner already has, migrates as the owner and starts the app as the login. Run `whisk doctor` first, since anything the app changes in the schema while it runs now fails. Removing the line starts the app as the owner again on the next deploy. **Looking at the data from your machine.** The database's own address is inside the platform, so connecting to it from outside does not work (`whisk db url` says so). Use these instead; they run on the platform, need nothing installed, and are audited: - `whisk db schema --json`: the PostgreSQL version and every table with its columns, keys and estimated row count. Read it first when planning an import or a migration. - `whisk db query "select … limit 20" --json`: the rows as JSON, values as PostgreSQL prints them. `--file script.sql` runs a script. Statements stop after 30 seconds; at most `--limit` rows come back (1000 by default). - Reads and additions run at once. SQL that would change or remove existing data (`update`, `delete`, upserts, `drop`, `alter`, `truncate`) does not run: it comes back as `CONFIRM_REQUIRED` saying what it would do and carrying a code. Check that the effect is what you meant, then run `whisk db query --confirm `. A restore point is taken first, and the result names the `whisk restore --at` that undoes it, on a plan with self-service restore. On Free nothing undoes it (`details.restorable` is `false`): copy the rows it changes first with `whisk db query "select …" --json`. - Do not put `begin` or `commit` in the SQL: each call is already one transaction. **Undoing a mistake.** Backups are continuous, and `whisk restore` returns the database to any minute in the plan's window: the last 7 days on Starter and Team, 30 on Business; Free has no self-service restore. `whisk db snapshot` marks a restore point before risky work and prints the command that returns to it, or says the plan cannot. `whisk restore --at