Deployment

Phase 0 deploy — static export Next.js → Cloudflare Pages via git integration.

Live (Phase 0): https://arno-ijr.pages.dev (opens in a new tab)

Key gotcha (2026)

Cloudflare merged the "Workers & Pages" UI. Through Create application you land in a Worker-like flow with minimal fields. But for a static site you still need a Pages-style wrangler.jsonc at the repo root:

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "arno",
  "compatibility_date": "2026-05-20",
  "pages_build_output_dir": "./apps/web/out"
}

Do not set assets.directory (that's for pure Workers with static assets — a different project type).

One-time setup

  1. Log in to the Cloudflare dashboard → Workers & PagesCreate applicationPagesConnect to Git
  2. Pick the GitHub account <old-github-user> → repo arno
  3. Project name: arno (gives arno.pages.dev; if taken — arno-app or similar)
  4. Branch: main
  5. Build settings:
    • Framework preset: None (not the Next.js preset — we run the static export ourselves)
    • Build command: corepack enable && pnpm install --frozen-lockfile && pnpm --filter @arno/web build
    • Build output directory: apps/web/out
    • Root directory: (leave empty = repo root)
  6. Environment variables:
    • NODE_VERSION = 20
    • PNPM_VERSION = 11.1.3
  7. Save and Deploy

After the first deploy

  • Public URL appears: https://arno.pages.dev (or whichever was assigned)
  • Subsequent push to main → auto-rebuild + redeploy
  • Preview deploys per PR — enabled by default

Custom domain (post-MVP)

Per master spec §III.2.9 — Porkbun as separate registrar. DNS TTL 300s. Connecting the domain → Pages comes later (Phase 16).

SPOF mitigation (master spec §III.2.9)

Immediately after the first deploy:

  • Add a second admin to the Cloudflare account (hardware key 2FA)
  • Save the CF API token in 2 password manager backups
  • Document in docs/runbooks/cloudflare_account_loss.md (Phase 16)

Troubleshooting

Build fails with "pnpm: command not found":

  • Check the PNPM_VERSION env var
  • Alternative: npm install -g pnpm@11.1.3 && pnpm install && pnpm build

Static export output empty:

  • Check that next.config.mjs has output: "export"
  • apps/web/out/index.html must exist after pnpm --filter @arno/web build

404 on routes:

  • trailingSlash: true in next.config.mjs — required for static export

When to change the deploy strategy

Static export is enough through Phase 8 (introduce Auth). Phase 8-9 — switch to:

  • Option A: @cloudflare/next-on-pages adapter — Edge runtime
  • Option B: Workers Static Assets with OpenNext — more modern, closer to Vercel

The decision lands in Phase 8 after assessing the ecosystem (2026).