> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryardent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase

> Connect your Supabase Postgres database to Ardent

Ardent is compatible with Supabase Postgres.

**Want Claude or Cursor to help?** Paste this prompt into your agent:

```
Check if my Supabase database is ready to connect to Ardent.
My connection string: [paste here]

Use Ardent preflight first:
ardent connector preflight postgresql '<connection-string>' --schemas public

Verify:
1. This is the Direct connection string, not the pooler string.
2. IPv4 is enabled for the Supabase project.
3. The URL points to the writable primary: SELECT pg_is_in_recovery(); must return false.
4. Logical replication and wal2json are available.
5. The Ardent preflight Grant script has been run for the schemas I want to replicate.
6. Tables selected for replication have a primary key, valid unique NOT NULL index, or REPLICA IDENTITY FULL.

After preflight passes, run:
ardent connector create postgresql '<connection-string>'
```

***

<Steps>
  <Step title="Open the Connect dialog">
    In your Supabase project dashboard, click **Connect** in the top right corner.

    Select the **Direct** tab, choose **Direct connection** as the connection method, and set Type to **URI**.

    <Warning>
      Do not use the pooler connection string for Ardent. Logical replication needs a direct Postgres connection.
    </Warning>
  </Step>

  <Step title="Check IPv4">
    Scroll down in the Connect dialog. You'll see an **IPv4 compatible** indicator.

    If it shows a checkmark, you're good. If not, click **IPv4 settings** and enable the dedicated IPv4 add-on. Ardent needs a direct IPv4 route to your database.
  </Step>

  <Step title="Copy your connection string">
    Still in the Connect dialog, copy the URI. It looks like:

    ```text theme={null}
    postgresql://postgres:[YOUR-PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres
    ```

    Wrap the URI in single quotes when you use it in a shell.
  </Step>

  <Step title="Run preflight">
    ```bash theme={null}
    ardent connector preflight postgresql 'postgresql://postgres:[YOUR-PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres' --schemas public
    ```

    Preflight checks reachability, credentials, source writability, logical replication, permissions, and duplicate-source status without creating a connector or storing credentials. It also prints a generated grant script.

    If preflight says the source is a read replica, use the writable primary database URL instead. Ardent refuses read replicas because full-fidelity branching needs a source that can support logical replication and schema tracking.
  </Step>

  <Step title="Run the generated grant script if needed">
    If preflight reports missing grants, copy the **Grant script** section and run it in `psql` as a Supabase role allowed to grant those privileges.

    Then re-run preflight. Do not create the connector until preflight passes.
  </Step>

  <Step title="Connect your database">
    ```bash theme={null}
    ardent connector create postgresql 'postgresql://postgres:[YOUR-PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres'
    ```

    Ardent stores encrypted credentials, discovers your schema, snapshots selected tables, and starts continuous replication. Initial setup time depends on data size, write rate, and network throughput.
  </Step>

  <Step title="Create your first branch">
    When the connector is ready:

    ```bash theme={null}
    ardent branch create my-feature
    ```

    Done. You now have an isolated copy of your Supabase database: schema, data, and all. The CLI returns a connection URL you can use anywhere.
  </Step>
</Steps>
