Production deploy
Checklist for shipping apps/web (and optional api-console) against a hosted Supabase project (e.g. Vercel + Supabase Cloud).
Local pre-release (npm run pre-release:web) validates against a local stack. Run npm run production:check before or after pointing production env vars at your hosted project.
AI-specific hardening (generation webhooks, fal.ai, credits cron): Production hardening.
1. Supabase project
-
Create a project at supabase.com (or use an existing one).
-
Link CLI and push schema:
supabase link --project-ref <ref> npm run db:push -
Apply seed data if you want the default
demoorg:supabase db execute --file supabase/seed.sqlOr create your first workspace via sign-up in the app.
-
Note Project URL and anon (publishable) key from Dashboard → Settings → API.
2. Edge Functions
Billing (SaaS core)
supabase secrets set STRIPE_SECRET_KEY=sk_... STRIPE_WEBHOOK_SECRET=whsec_... STRIPE_PRICE_TEAM=price_...
supabase functions deploy billing-create-checkout
supabase functions deploy billing-create-portal
supabase functions deploy billing-cancel-subscription
supabase functions deploy billing-update-subscription
supabase functions deploy billing-list-invoices
supabase functions deploy stripe-webhookStripe webhook URL: https://<project-ref>.supabase.co/functions/v1/stripe-webhook
See Stripe local setup for event types and CI smoke.
AI (this repo)
Deploy generation and public API functions and set secrets (FAL_API_KEY, GENERATION_WEBHOOK_SECRET, CREDITS_CRON_SECRET, etc.). See Providers and Production hardening.
production:check validates billing functions from the upstream manifest; add AI function checks in your fork manifest when you automate them.
3. Auth redirect URLs
In Supabase Dashboard → Authentication → URL configuration:
| Setting | Example |
|---|---|
| Site URL | https://your-app.vercel.app |
| Redirect URLs | https://your-app.vercel.app/** |
Include: /auth/callback, /auth/reset-password, /auth/confirm-email.
4. Frontend (Vercel or static host)
-
Build with production Supabase settings —
npm run build:web:vercelwrites settings from env. -
Set on the host:
Variable Purpose SUPABASE_URLHosted project URL SUPABASE_ANON_KEYPublishable anon key -
SPA fallback to
index.htmlfor client routes.
API console is a separate deployable — see API console README .
5. Pre-flight: production:check
Copy .env.example → .env with hosted values:
SUPABASE_URL=https://<ref>.supabase.co
SUPABASE_ANON_KEY=eyJ...
APP_URL=https://your-app.vercel.app # optional — redirect checklist
SEED_ORG_SLUG=demo
SEED_ADMIN_EMAIL=... # optional — login smoke
SEED_ADMIN_PASSWORD=...npm run production:check| Check | Fails when |
|---|---|
SUPABASE_URL / SUPABASE_ANON_KEY | Missing |
| Auth health | Project unreachable |
| Anon key | Rejected by REST |
| Project ref | URL ref ≠ JWT ref |
| Schema tables | Migrations missing |
| Billing Edge Functions | HTTP 404 |
| Seed org | Warns if slug missing |
| Seed admin login | Fails when credentials set but login fails |
| Auth redirects | Warns when APP_URL set |
Manifest: scripts/production-check.manifest.json. Exit 0 = no failures (warnings OK).
6. Post-deploy smoke
- Open
APP_URL— sign in or register. - Settings → Billing (mock or Stripe).
- Boards → Generate (if AI functions deployed).
- Optional:
npm run monitor:prodornpm run e2e:web:releaseagainst staging.
Troubleshooting
| Symptom | Likely cause |
|---|---|
| Login redirects to localhost | Site URL / redirect URLs still local |
| Billing 404 | Billing Edge Functions not deployed |
| Generate fails | AI functions or FAL_API_KEY missing |
organizations missing | db:push not run on hosted DB |
| Anon key mismatch | Env from project A, key from project B |