supabase-multi-env-setup
Installation
SKILL.md
Supabase Multi-Environment Setup
Overview
Production Supabase deployments require separate projects per environment — each with its own URL, API keys, database, and RLS policies. This skill configures a three-tier environment architecture (local dev, staging, production) with safe migration promotion via supabase db push, environment-aware createClient initialization, database branching for preview deployments, and CI/CD pipelines that prevent accidental cross-environment operations.
When to use: Setting up a new project with multiple environments, migrating from a single-project setup to multi-env, adding staging to an existing dev/prod split, or configuring preview environments with database branching.
Prerequisites
- Three separate Supabase projects created at supabase.com/dashboard (dev, staging, production)
- Supabase CLI installed:
npm install -g supabaseornpx supabase --version @supabase/supabase-jsv2+ installed in your project- Node.js 18+ with framework that supports
.envfiles (Next.js, Nuxt, SvelteKit, etc.) - A secret management solution for CI (GitHub Actions Secrets, Vercel env vars, etc.)
Instructions
Step 1: Environment Files and Project Layout
Related skills