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.
pnpm install
pnpm lint
pnpm typecheck
pnpm buildAPI 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).
pnpm --filter @premortem/api build
cd apps/api && pnpm run deployCloudflare 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
PREMORTEM_WEB_BASE=https://premortem.jstn.site \
PREMORTEM_API_BASE=https://api.jstn.site \
pnpm run smoke:production-readinesspnpm run dev
pnpm run smoke:full-app-stress
pnpm run smoke:production-readiness