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

# Connect to PostgreSQL

> Connect Tamery to PostgreSQL: connection string format, SSL options, and provider tips.

Tamery accepts both `postgresql://` and `postgres://`:

```bash theme={null}
postgresql://username:password@hostname:5432/database
```

| Part       | Description                                 |
| ---------- | ------------------------------------------- |
| `username` | PostgreSQL user (e.g. `postgres`)           |
| `password` | Password for that user                      |
| `hostname` | Host (e.g. `localhost` or a remote address) |
| `5432`     | Port (default)                              |
| `database` | Database name                               |

## Parameters

Append query parameters after the database name with `?`, separated by `&`.

| Parameter          | Description                      | Example                   |
| ------------------ | -------------------------------- | ------------------------- |
| `sslmode`          | SSL/TLS negotiation              | `sslmode=require`         |
| `connect_timeout`  | Max seconds to open a connection | `connect_timeout=10`      |
| `application_name` | Label in `pg_stat_activity`      | `application_name=tamery` |

```bash theme={null}
postgresql://username:password@hostname:5432/database?sslmode=require&connect_timeout=10
```

## SSL / TLS

| `sslmode`     | Behavior                                       |
| ------------- | ---------------------------------------------- |
| `disable`     | No SSL                                         |
| `require`     | SSL on, certificate not verified               |
| `verify-ca`   | SSL on, certificate must be from a trusted CA  |
| `verify-full` | SSL on, trusted CA **and** hostname must match |

`require` works for most managed providers; use `verify-full` for stricter setups.

## Providers

<Tabs>
  <Tab title="Supabase">
    **Settings → Database → Connection string**. Replace `[YOUR-PASSWORD]`.

    ```bash theme={null}
    postgresql://postgres:[YOUR-PASSWORD]@db.<project-ref>.supabase.co:5432/postgres
    ```

    Supabase requires SSL — add `?sslmode=require` if missing.
  </Tab>

  <Tab title="Neon">
    Copy either the pooled or direct string from the dashboard — both include SSL settings.

    ```bash theme={null}
    postgresql://username:password@ep-<name>.us-east-2.aws.neon.tech/neondb?sslmode=require
    ```
  </Tab>

  <Tab title="Railway">
    Project → PostgreSQL service → **Connect** → **Database URL**.

    ```bash theme={null}
    postgresql://postgres:password@monorail.proxy.rlwy.net:12345/railway
    ```
  </Tab>

  <Tab title="Local">
    ```bash theme={null}
    postgresql://postgres:password@localhost:5432/mydb
    ```

    Depending on `pg_hba.conf`, you may be able to omit the password.
  </Tab>
</Tabs>

<Tip>
  Always **Test connection** before saving. If it fails, check host, port, credentials, database
  name, and SSL parameters.
</Tip>
