Docs
Connecting

Branch connections

Connect to a specific Silos branch using its own endpoint host.

Silos branches are copy-on-write forks of a database — created in seconds, ideal for a preview environment, a test run, or an experiment. Each branch has its own endpoint host, so connecting to a branch is just a matter of pointing your client at that host.

The branch endpoint host

A branch endpoint adds the branch name to the host, separated by a double dash:

postgres://user:password@db-xxxx--branchname.silos.sh/main?sslmode=require
HostConnects to
db-xxxx.silos.shThe primary branch
db-xxxx--preview.silos.shThe branch named preview
db-xxxx--pr-218.silos.shThe branch named pr-218

Everything else about the connection — the role, the database name, sslmode=require, SCRAM-SHA-256 auth — is identical to the primary connection string.

You can print a branch's connection string from the CLI, or copy it from the branch's page in the Console.

A connection string per environment

Because each branch is a separate endpoint, the cleanest pattern is one DATABASE_URL per environment, each pointing at a different branch:

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

Your application code doesn't change — only the host in the connection string does. This is what makes per-PR preview databases straightforward: create a branch, hand its connection string to the deploy, tear the branch down when the PR closes.

Next steps

On this page