Skip to content

Connecting to PostgreSQL

Every database exposes two connection URLs. Use the one that matches where you’re connecting from.

URLWhen to use it
InternalFrom other Runsite services in the same project. Traffic never leaves the private network: lowest latency, no public exposure.
ExternalFrom your laptop, third-party tools, or anything running outside Runsite. Encrypted with TLS.

Both are standard PostgreSQL connection strings. You’ll find them on the database’s Overview tab. Copy them directly rather than constructing them by hand.

A real internal URL looks like:

postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv-rw:5432/test

A real external URL looks like:

postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv.eu-central-postgres.runsite.app/test

Notice:

  • The internal host (dpg-...-rw) is short and only resolves inside Runsite. The -rw part points to the read-write primary.
  • The external host adds the region and base domain (eu-central-postgres.runsite.app).
  • The internal URL keeps the explicit :5432. The external URL omits it, so clients use the standard Postgres port by default.
  • Username and database name come from what you set when creating the database.

Inside another Runsite service in the same project, use the internal URL. Add it as an environment variable in the service’s Environment tab:

Terminal window
DATABASE_URL=postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv-rw:5432/test

Your app reads DATABASE_URL like any other Postgres host. No special client needed.

Use the external URL with the psql CLI:

Terminal window
psql "postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv.eu-central-postgres.runsite.app/test"

Or paste it into your favourite client (DBeaver, TablePlus, DataGrip, pgAdmin); they all accept this URL format.

The dashboard masks the password in both URLs. Click the eye icon on the Overview tab to reveal it.

The password can’t be changed from the dashboard. If it leaks, create a new database and move the data across.

Connection failing? See Fix PostgreSQL connection errors.

IP geolocation by DB-IP