Skip to main content
Once you’ve developed and tested your project locally, you’re ready to deploy to production on the Supabase Platform. This guide walks through the deployment process and best practices.

Prerequisites

Before deploying, ensure you have:

Deployment Workflow

Step 1: Create a Project

Create a new project on the Supabase Dashboard:
  1. Click New Project
  2. Choose your organization
  3. Enter project details:
    • Name: Your project name
    • Database Password: Strong password (save this securely)
    • Region: Choose closest to your users
    • Plan: Select appropriate tier
Your project will take 2-3 minutes to provision.

Step 2: Authenticate with Supabase

Login to the Supabase CLI:
This opens your browser to generate a Personal Access Token. The token is stored securely in your system keychain. Link your local project to the remote project:
Select your project from the interactive list. Alternatively, specify the project directly:
Find your project ref in the Supabase Dashboard under Project SettingsGeneral.

Step 4: Deploy Migrations

Push your local migrations to production:
This applies all migration files in supabase/migrations/ to your remote database.
Migrations are applied in chronological order and cannot be rolled back automatically. Always test migrations locally first.

Step 5: Verify Deployment

Check your deployed schema in the Dashboard:
  1. Open your project in the Supabase Dashboard
  2. Navigate to Table Editor
  3. Verify all tables and columns are present
  4. Check SQL Editor for any errors

Environment Configuration

Get Production Credentials

Retrieve your production API credentials from the Dashboard:
  1. Go to Project SettingsAPI
  2. Copy the following:
    • Project URL
    • anon public key
    • service_role key (keep secret!)

Configure Your Application

Update your application to use production credentials:
.env.production
Never commit production credentials to version control. Use environment variables and .env.local for local development.

Seeding Production Data (Optional)

For staging environments, you may want to include seed data:
Never use seed data in production! Seed files are designed for development and may:
  • Overwrite existing data
  • Create test accounts
  • Insert fake data

Managing Multiple Environments

Strategy 1: Multiple Projects

Create separate Supabase projects for each environment:

Strategy 2: Branching (Team/Enterprise)

Use Supabase Branching to create preview environments:
Branching is available on Team and Enterprise plans.

Continuous Deployment

GitHub Actions

Automate deployments with GitHub Actions:
.github/workflows/deploy.yml

Required Secrets

Add these secrets to your GitHub repository:
  1. SUPABASE_ACCESS_TOKEN: Personal access token from Account Settings
  2. SUPABASE_DB_PASSWORD: Your database password
  3. SUPABASE_PROJECT_ID: Your project reference ID

GitHub Actions Setup

Learn more about the official Supabase GitHub Action

Post-Deployment Checklist

After deploying to production, verify the following:
1

Enable Row Level Security

Ensure all tables have RLS enabled:
Enable RLS on any missing tables:
2

Configure Auth Settings

  • Enable email confirmations
  • Set up custom SMTP for emails
  • Configure redirect URLs
  • Set appropriate session timeouts
Configure in AuthenticationProviders
3

Set Up Network Security

  • Enable SSL enforcement
  • Configure network restrictions
  • Review API settings
Configure in DatabaseSettings
4

Enable Backups

  • Daily backups (included in Pro plan)
  • Consider Point-in-Time Recovery (PITR) for databases > 4GB
Configure in DatabaseBackups
5

Test Your Application

  • Verify all CRUD operations
  • Test authentication flows
  • Check real-time subscriptions
  • Validate file uploads

Production Checklist

View the complete production readiness checklist

Schema Changes After Deployment

Making Changes

  1. Develop locally:
  2. Test thoroughly:
    • Run database tests
    • Test with seed data
    • Verify RLS policies
  3. Deploy to production:

Rolling Back Changes

If a migration causes issues:
  1. Create a rollback migration:
  2. Add reversal SQL:
  3. Deploy rollback:
Supabase doesn’t automatically generate rollback migrations. You must create them manually.

Monitoring Deployments

Database Logs

View deployment logs in the Dashboard:
  1. Go to LogsDatabase Logs
  2. Filter by time range
  3. Look for migration-related entries

API Logs

Monitor API usage:
  1. Go to LogsAPI Logs
  2. Check for errors after deployment
  3. Verify endpoint response times

Database Performance

Check database performance:
  1. Go to DatabasePerformance
  2. Review slow queries
  3. Check index usage

Troubleshooting

Error: migration failed to applySolution:
  • Check remote database logs in Dashboard
  • Verify migration works locally: supabase db reset
  • Ensure no conflicting schema changes were made in Dashboard
  • Check for permission issues
Error: Command appears stuckSolution:
  • Check network connection
  • Verify database is running (not paused)
  • Try with verbose logging: supabase db push --debug
  • Check for large migrations (may take time)
Error: Invalid API keySolution:
  • Regenerate keys in Dashboard: SettingsAPI
  • Check for extra whitespace in environment variables
  • Verify you’re using anon key (not service_role) for client
  • Ensure keys match your project

Best Practices

1. Always Test Locally First

2. Use Staging Environment

Test in staging before production:

3. Document Breaking Changes

Comment migrations that require application updates:

4. Deploy During Low-Traffic

Schedule deployments during off-peak hours to minimize impact.

5. Monitor After Deployment

Watch for issues in the first hour after deployment:
  • Check error logs
  • Monitor API response times
  • Verify key user flows

Next Steps

Production Checklist

Complete pre-launch checklist

Security Best Practices

Secure your production environment

Monitoring & Logs

Set up production monitoring

Branching

Use preview environments for testing