> ## 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.

# PlanetScale

> Connect your PlanetScale Postgres database to Ardent

Ardent is compatible with PlanetScale Postgres.

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

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

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

Verify:
1. The host is reachable and credentials work.
2. Logical replication is enabled in the PlanetScale dashboard.
3. The URL points to the writable primary: SELECT pg_is_in_recovery(); must return false.
4. The user has replication privileges.
5. 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="Enable logical replication">
    In your PlanetScale dashboard, go to **Settings > Integrations** and enable **Logical Replication**. This allows Ardent to replicate your data for branching.
  </Step>

  <Step title="Find your connection string">
    Go to **Connect > Connect with: Postgres** in your PlanetScale dashboard and copy the connection string. It looks like:

    ```
    postgresql://user:[YOUR-PASSWORD]@aws.connect.psdb.cloud/mydb?sslmode=require
    ```

    Wrap the URI in single quotes when you use it in a shell. The `?sslmode=…` part must not be interpreted by the shell.
  </Step>

  <Step title="Run preflight">
    ```bash theme={null}
    ardent connector preflight postgresql 'postgresql://user:[YOUR-PASSWORD]@aws.connect.psdb.cloud/mydb?sslmode=require'
    ```

    Preflight checks reachability, credentials, source writability, logical replication, permissions, and duplicate-source status without creating a connector or storing credentials.

    If preflight reports missing grants or configuration, fix those first and 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://user:[YOUR-PASSWORD]@aws.connect.psdb.cloud/mydb?sslmode=require'
    ```

    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">
    ```bash theme={null}
    ardent branch create my-feature
    ```

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