Deploy to production

Deploy Premortem on Cloudflare Pages and Worker with Supabase, Neo4j, and Stripe using the production env wrapper.

Deploy Premortem on Cloudflare Pages and Worker with Supabase, Neo4j, and Stripe using the production env wrapper.

Production

Never set PREMORTEM_AUTH_DISABLED in production. Use Supabase Auth for /app access.

Runtime topology

  • Web (Next.js BFF, marketing, /app): Cloudflare Pages at premortem.jstn.site.
  • API (audit orchestration): Cloudflare Worker at api.jstn.site.
  • Database + Auth: Supabase Postgres pooler and Auth.
  • Graph: Neo4j Aura or self-hosted Bolt URI.
  • Billing: Stripe Checkout + webhooks.

CI pipeline

  • Push to main runs lint, typecheck, and build via GitHub Actions.
CI steps (.github/workflows/ci.yml)
pnpm install
pnpm lint
pnpm typecheck
pnpm build

API Worker

  • Requires CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID in GitHub secrets.
  • The deploy wrapper loads repo-root .env.production and sets CLOUDFLARE_ENV=production before wrangler runs.
  • Queue bootstrap creates premortem-audit-jobs and premortem-audit-jobs-dlq during deploy when Cloudflare credentials are present.
  • Set Worker secrets via wrangler (DATABASE_URL, GEMINI_API_KEY, GitLab OAuth, Neo4j, Supabase service role).
Manual Worker deploy
pnpm --filter @premortem/api build
cd apps/api && pnpm run deploy

Cloudflare Pages

  • Connect GitHub repo; production branch main.
  • Build: pnpm install --frozen-lockfile && pnpm run build:pages.
  • The build wrapper loads repo-root .env.production and sets CLOUDFLARE_ENV=production before the Pages build starts.
  • Set NEXT_PUBLIC_APP_URL=https://premortem.jstn.site and PREMORTEM_API_BASE_URL=https://api.jstn.site.
  • Include Supabase public keys, Stripe secrets, Sentry/PostHog public keys on Pages.
Note

See Environment variables reference for the full production variable list.

Stripe webhooks

  • Webhook endpoint: https://premortem.jstn.site/api/stripe/webhook.
  • Map Starter, Growth, and Scale price IDs to STRIPE_PRICE_PRO, STRIPE_PRICE_TEAM, STRIPE_PRICE_SCALE, and annual variants.
  • Test mode uses sk_test_*; live mode drives entitlements via webhook events.

Pre-flight checks

Production verification (against live URLs)
PREMORTEM_WEB_BASE=https://premortem.jstn.site \
PREMORTEM_API_BASE=https://api.jstn.site \
pnpm run smoke:production-readiness
Local before push
pnpm run dev
pnpm run smoke:full-app-stress
pnpm run smoke:production-readiness

View source on GitHub

Expected result

Marketing and /app on premortem.jstn.site, API on api.jstn.site, verification checks passing.

Related links

Announcement updates version release today!

ReleasesPrivacy
Terms