Home / Integrations / Supabase
Supabase
Use Claude Code to generate Supabase migrations, write Row Level Security policies, build Edge Functions, and scaffold full-stack features.
Setup
- 1.Install the Supabase CLIClaude Code uses the Supabase CLI to manage migrations, run local development, and deploy Edge Functions. Install it globally.
npm install -g supabase - 2.Initialize Supabase in your projectIf your project does not already use Supabase, initialize it. This creates the supabase/ directory with config files and migration folders.
supabase init - 3.Link to your Supabase projectConnect your local setup to a remote Supabase project so Claude Code can deploy migrations and functions.
supabase link --project-ref your-project-ref - 4.Start the local development stackRun the local Supabase stack so Claude Code can test migrations and queries against a local database before deploying to production.
supabase start
Features
- +Generates SQL migrations with proper up/down scripts for schema changes
- +Writes Row Level Security (RLS) policies that enforce your authorization logic
- +Creates Supabase Edge Functions in TypeScript with proper Deno imports
- +Scaffolds client-side code using the @supabase/supabase-js library
- +Tests queries against the local Supabase instance before deploying
- +Generates TypeScript types from your database schema using supabase gen types
Use Cases
Describe your data model and Claude Code generates a complete SQL migration with tables, indexes, constraints, and RLS policies. It runs the migration locally to verify it works.
Security policies are notoriously tricky to get right. Describe who should access what data, and Claude Code writes the SQL policies, tests them against sample queries, and verifies they block unauthorized access.
Ask Claude Code to build a feature end to end: database tables, RLS policies, a Supabase Edge Function for server logic, and client-side React components that call the Supabase client.
Claude Code writes Supabase Edge Functions using Deno, handles CORS, validates request bodies, and connects to the database using the service role key — all following Supabase conventions.
Why Claude Code excels with Supabase
Supabase development involves multiple layers: SQL schema design, Row Level Security policies, Edge Functions, client library integration, and type generation. Claude Code handles all of these because it can read SQL files, write migrations, execute CLI commands, and generate TypeScript — switching between layers seamlessly in a single session.
The local Supabase development stack is particularly valuable with Claude Code. The agent can run migrations against a local PostgreSQL instance, execute test queries, verify RLS policies, and iterate until everything works — all before touching your production database.
Example: building a feature with Supabase
RLS policy generation
Can Claude Code connect to my production Supabase database?+
Does Claude Code understand Supabase Auth?+
Can Claude Code write Supabase Edge Functions?+
Related tools
Related terms
Master Claude Code in days, not months
37 hands-on lessons from beginner to CI/CD automation. Module 1 is free.
START FREE →