What we do
All instructions
Data and sign-in: Supabase

Connect Supabase with Claude

Your AI needs four values from your Supabase project to build your app's database. You paste them into your app's key file, .env.local, which stays on your computer. Never paste them into the chat. The same steps work in Codex.

About 10 minutesMac and WindowsLast checked

Why a file, not the chat

Whatever you type in the chat leaves your computer, and Supabase's own advice is that a secret key should never travel over chat, email or text. Your app reads the file directly, and the AI uses it without reading the keys out. Supabase can also link AI tools to your whole account; we don't, because this file opens only the one project.

Have these ready

Steps

  1. Step 1: Let your AI open the key file

    When it's ready for Supabase, it makes a file named .env.local in your app's folder and opens it for you. Keep it open for the next steps.

    Mac
    It opens in TextEdit.
    Windows
    It opens in Notepad.

    You should see: Four lines, each a name in capitals followed by = and nothing yet. Two start with NEXT_PUBLIC, then come SUPABASE_SECRET_KEY= and SUPABASE_DB_URL=.

    If it looks different: Nothing opened? Ask your AI: Please open .env.local for me.

  2. Step 2: Open Connect in Supabase

    In your Supabase project, click Connect in the bar at the top, then Framework.

    You should see: Connect to your project, with a block for Next.js whose first line starts NEXT_PUBLIC_SUPABASE_URL=.

  3. Step 3: Copy the first two lines into your file

    Click the copy button on that block. In your file, select the two empty lines that start with NEXT_PUBLIC, and paste over them.

    You should see: Both lines with a value after =. The first ends in .supabase.co, and the second starts sb_publishable_.

    If it looks different: If the block says ANON_KEY instead, your project has older keys: open Project Settings, then API Keys, click Create new API keys, and come back.

  4. Step 4: Copy the secret key

    Click the gear icon for Project Settings, then API Keys. Under Secret keys, click the copy button next to the key named default: it copies the whole key without showing it. Paste it right after SUPABASE_SECRET_KEY=, with no space.

    You should see: The line SUPABASE_SECRET_KEY= followed by your key, which starts sb_secret_.

    If it looks different: A long key that starts eyJ is the older kind. Use the one that starts sb_secret_.

  5. Step 5: Copy the database connection

    Click Connect again, then Direct. Under Connection Method, choose Session pooler. Copy the connection string and paste it right after SUPABASE_DB_URL=.

    You should see: A line that starts SUPABASE_DB_URL=postgresql://, with [YOUR-PASSWORD] in the middle.

    If it looks different: Make sure it's the Session pooler string: it works on every home and office network.

  6. Step 6: Put your database password in

    In that line, select [YOUR-PASSWORD], square brackets included, and paste your database password over it.

    You should see: Your password where [YOUR-PASSWORD] was, with no brackets left.

    If it looks different: Lost the password? In Supabase, click Database, then Settings, and Reset password under Reset database password. Paste the new one here.

  7. Step 7: Save the file and close it

    Mac
    Press Command-S, then close the window.
    Windows
    Press Ctrl+S, then close the window.

    You should see: The window closes without asking about unsaved changes.

  8. Step 8: Tell your AI it's saved

    Type done. Don't paste the keys into the chat.

    You should see: Your AI says it's connected, then sets up your app's tables.

    If it looks different: If it says a value is missing or doesn't work, open the file again and check each line: the value comes right after =, with no spaces or quotes.

  9. Step 9: Check the tables in Supabase

    Once your AI says the tables are ready, click Table Editor in Supabase's left sidebar.

    You should see: Your app's tables listed, such as customers or bookings.

    If it looks different: A red Unrestricted badge on a table means anyone could read it. Tell your AI which table, and it will lock it down.