Docs
Connecting

Connection strings

How to read a Silos connection string, what each part means, and why SSL is always required.

Silos speaks the standard PostgreSQL wire protocol, so you connect with the same connection string format you'd use for any Postgres server. Your database has an endpoint host, a role, a password, and a database name.

Anatomy of a connection string

postgres://user:password@db-xxxx.silos.sh/main?sslmode=require
PartExampleWhat it is
Schemepostgres://The Postgres protocol. postgresql:// works too.
Role & passworduser:passwordThe database role and its password.
Endpoint hostdb-xxxx.silos.shYour database's unique endpoint.
Database namemainThe database to connect to.
SSL mode?sslmode=requireEncrypts the connection. Always required.

You can copy a ready-made connection string from the Console, or print one from the CLI with silos db connection-string.

SSL is always required

Every Silos connection is encrypted with TLS 1.3. Connections that don't negotiate TLS are rejected, so include sslmode=require (or stricter) in your connection string. Authentication uses SCRAM-SHA-256, the modern Postgres password mechanism — your driver handles it automatically.

psql "postgres://user:password@db-xxxx.silos.sh/main?sslmode=require"

If your client needs the SSL setting as a separate option rather than a query parameter, set it the way that client expects — for example, PGSSLMODE=require as an environment variable, or an ssl: true option in a driver config.

Where to put the connection string

Treat the connection string as a secret — it contains a password. Keep it out of source control and load it from an environment variable:

.env
DATABASE_URL="postgres://user:password@db-xxxx.silos.sh/main?sslmode=require"

Most drivers and frameworks read DATABASE_URL by convention:

connect.ts
import { Client } from 'pg'

const client = new Client({ connectionString: process.env.DATABASE_URL })
await client.connect()

Connecting to a branch

Branches get their own endpoint host. To connect to a branch, use its host instead of the primary's — see Branch connections.

Next steps

On this page