Deploy runbook
Every worker’s wrangler.jsonc has a local top level and named environments; every deploy names an
environment, and the plain deploy scripts refuse to run. Staging is the only deployed environment.
Staging, one command
Section titled “Staging, one command”pnpm check # typecheck, lint, tests, workerd e2e: all green firstpnpm deploy:staging # migrations on Neon, then API, MCP, web build and deploypnpm deploy:staging --skip-migrate # code onlypnpm deploy:staging --only web # one of api | mcp | webpnpm deploy:landing # the landing pagepnpm --filter @zyropay/docs build && pnpm --filter @zyropay/docs deploy:staging # this sitepnpm health # health check of the deployed API, MCP and web appscripts/deploy-staging.mjs takes the direct database URL from the Neon CLI and stops if that fails.
It needs wrangler login and Neon CLI authentication on the machine, and never touches secrets.
The API and MCP workers bind to each other, and Cloudflare refuses a service binding to a worker that does not exist yet, so a first deploy goes MCP (without its binding), then API, then MCP again.
The docs site
Section titled “The docs site”apps/docs is a static Astro Starlight build served by Workers static assets (zyropay-online-docs,
custom domain docs.zyropay.online, no workers.dev route). pnpm build:
- copies the generated
docs/API.mdanddocs/MCP.mdin as reference pages; - checks every pre-rendered diagram is up to date with its source (
pnpm diagramsre-renders them with a headless Chromium); - builds the site, validating every internal link and anchor;
- writes
dist/_headers(CSP with hashes of the few inline scripts,noindex, caching) and checks everyhrefandsrcin the output resolves to a file.
After a deploy
Section titled “After a deploy”curl https://api.zyropay.online/healthanswers{"ok":true,"mode":"development","mocks":false}.- Open the web app, create a passkey, and check the session starts.
- Point an agent at
https://mcp.zyropay.online/mcpand run a paid request (user guide).
Roll back
Section titled “Roll back”pnpm --filter @zyropay/api exec wrangler deployments list --env stagingpnpm --filter @zyropay/api exec wrangler rollback <version-id> --env staging -m "reason" -y# the same for @zyropay/mcp, @zyropay/web-host and @zyropay/docsA rollback restores that version’s code, settings and secrets. It does not touch the database: migrations are forward-only, so roll a schema back with a new migration or Neon’s point-in-time restore.