ScaleRocket/Web

Supabase Production

Production project setup, migrations, Edge Function deployment, secrets, and monitoring.

Overview

Moving from local Supabase to a production project. This guide covers creating the project, applying migrations, deploying Edge Functions, and configuring secrets.

Production Project Setup

1. Create a Supabase project

  1. Go to supabase.com/dashboard.
  2. Click New Project.
  3. Choose your organization, name, database password, and region.
  4. Wait for the project to be provisioned.
pnpm supabase login
pnpm supabase link --project-ref <your-project-ref>

The project ref is in your Supabase dashboard URL: https://supabase.com/dashboard/project/<project-ref>.

3. Get your credentials

From the Supabase dashboard under Settings > API:

  • Project URL: https://xxx.supabase.co
  • Anon key: eyJ... (safe for client-side)
  • Service role key: eyJ... (server-side only)

Migrations

Apply all migrations to production

pnpm supabase db push

This runs all migration files from supabase/migrations/ in order against your production database.

Check migration status

pnpm supabase migration list

Shows which migrations have been applied and which are pending.

Create a new migration

pnpm supabase migration new my_change_name

Edit the generated SQL file, test locally, then push to production.

Pull remote changes

If you made changes directly in the Supabase dashboard (not recommended for production):

pnpm supabase db pull

This generates a migration file capturing the diff.

Edge Functions Deployment

Deploy all functions

pnpm supabase functions deploy

Deploy a specific function

pnpm supabase functions deploy stripe-checkout
pnpm supabase functions deploy stripe-webhook
pnpm supabase functions deploy stripe-portal

Verify deployment

pnpm supabase functions list

Check that all functions show ACTIVE status.

Function URLs

Your Edge Functions are available at:

https://<project-ref>.supabase.co/functions/v1/<function-name>

Use this URL for:

  • Stripe webhook endpoint configuration
  • Client-side supabase.functions.invoke() calls (handled automatically by the SDK)

Secrets Configuration

Set all required secrets for Edge Functions:

# Stripe
pnpm supabase secrets set STRIPE_SECRET_KEY=sk_live_xxx
pnpm supabase secrets set STRIPE_WEBHOOK_SECRET=whsec_xxx

# Resend
pnpm supabase secrets set RESEND_API_KEY=re_xxx

# URLs
pnpm supabase secrets set SITE_URL=https://yourdomain.com
pnpm supabase secrets set APP_URL=https://app.yourdomain.com

Verify secrets are set:

pnpm supabase secrets list

Note: SUPABASE_URL, SUPABASE_ANON_KEY, and SUPABASE_SERVICE_ROLE_KEY are automatically available in Edge Functions -- do not set them manually.

Authentication Setup

Configure OAuth providers

  1. Go to Authentication > Providers in the Supabase dashboard.
  2. Enable Google, GitHub, or other providers.
  3. Add the client ID and secret from each provider.
  4. Set the Redirect URL to: https://xxx.supabase.co/auth/v1/callback

Configure email templates

  1. Go to Authentication > Email Templates.
  2. Customize the confirmation, invitation, and password reset emails.
  3. Update the redirect URLs to point to your production domain.

Set redirect URLs

Under Authentication > URL Configuration:

  • Site URL: https://app.yourdomain.com
  • Redirect URLs: Add all allowed redirect URLs:
    https://app.yourdomain.com/auth/callback
    https://app.yourdomain.com/auth/reset-password

Monitoring

Database

  • Dashboard > Database: View table sizes, active connections, query performance.
  • Dashboard > Logs: SQL query logs, auth logs, Edge Function logs.

Edge Functions

  • Dashboard > Edge Functions: View invocation counts, error rates, and logs per function.
  • Click on a function to see recent invocations with request/response details.

Alerts

Enable alerts in Settings > Notifications for:

  • Database approaching storage limit
  • High error rate on Edge Functions
  • Auth rate limiting triggered

Production Checklist

  • Migrations applied (pnpm supabase db push)
  • Edge Functions deployed (pnpm supabase functions deploy)
  • All secrets set (pnpm supabase secrets list)
  • OAuth providers configured with production credentials
  • Email templates customized
  • Redirect URLs updated to production domains
  • Stripe webhook endpoint set to production Edge Function URL
  • RLS policies verified on all tables
  • Database backups enabled (requires Supabase Pro plan)

Done reading? Mark this page as complete.

On this page