Skip to content

Home / Integrations / Supabase

Database

Supabase

Use Claude Code to generate Supabase migrations, write Row Level Security policies, build Edge Functions, and scaffold full-stack features.

Setup

  1. 1.
    Install the Supabase CLI
    Claude Code uses the Supabase CLI to manage migrations, run local development, and deploy Edge Functions. Install it globally.
    npm install -g supabase
  2. 2.
    Initialize Supabase in your project
    If your project does not already use Supabase, initialize it. This creates the supabase/ directory with config files and migration folders.
    supabase init
  3. 3.
    Link to your Supabase project
    Connect your local setup to a remote Supabase project so Claude Code can deploy migrations and functions.
    supabase link --project-ref your-project-ref
  4. 4.
    Start the local development stack
    Run 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

Schema design and migration

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.

RLS policy development

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.

Full-stack feature scaffolding

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.

Edge Function development

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?+
Claude Code uses the Supabase CLI, which can connect to both local and remote instances. For safety, it is recommended to develop and test against the local stack (supabase start) and only deploy to production after review.
Does Claude Code understand Supabase Auth?+
Yes. Claude Code can scaffold authentication flows using @supabase/auth-helpers, configure OAuth providers, and write RLS policies that reference auth.uid() for user-specific access control.
Can Claude Code write Supabase Edge Functions?+
Yes. It generates Edge Functions in TypeScript targeting the Deno runtime, including proper import maps, CORS handling, request validation, and database access via the supabase-js client.

Related tools

Claude CodeCursorCline

Related terms

Agentic CodingModel Context Protocol (MCP)Agent kodowania

Master Claude Code in days, not months

37 hands-on lessons from beginner to CI/CD automation. Module 1 is free.

START FREE →
← ALL INTEGRATIONS