Supabase CLI
Key workflows for the Supabase CLI in Claude Code sessions.
When to Use
- Setting up a new Supabase project
- Running database migrations
- Deploying Edge Functions
- Generating TypeScript types from your schema
Core Commands
Project Setup
supabase init # Initialize project
supabase start # Start local dev (Docker required)
supabase status # Check local services
supabase stop # Stop local services
Database Migrations
supabase migration new <name> # Create migration file
supabase db diff --schema public # Auto-generate migration from schema changes
supabase db push # Apply migrations to remote
supabase db reset # Reset local DB + re-run all migrations
supabase migration list # List applied migrations
Edge Functions
supabase functions new <name> # Scaffold Edge Function
supabase functions serve # Local dev server with hot reload
supabase functions deploy <name> # Deploy to production
supabase functions deploy # Deploy all functions
Type Generation
supabase gen types typescript --local > types/supabase.ts # From local DB
supabase gen types typescript --project-id <id> > types/supabase.ts # From remote
Linking & Auth
supabase link --project-ref <ref> # Link to remote project
supabase login # Authenticate CLI
Best Practices
- Always create migrations via
supabase db diffrather than writing SQL by hand - Run
supabase db resetafter pulling migration changes from teammates - Generate types after every schema change to keep TypeScript in sync
- Use
supabase functions servefor local testing before deploying