Connecting to PostgreSQL
Every database exposes two connection URLs. Use the one that matches where you’re connecting from.
Internal vs external
Section titled “Internal vs external”| URL | When to use it |
|---|---|
| Internal | From other Runsite services in the same project. Traffic never leaves the private network: lowest latency, no public exposure. |
| External | From 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/testA real external URL looks like:
postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv.eu-central-postgres.runsite.app/testNotice:
- The internal host (
dpg-...-rw) is short and only resolves inside Runsite. The-rwpart 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.
From a Runsite Web Service
Section titled “From a Runsite Web Service”Inside another Runsite service in the same project, use the internal URL. Add it as an environment variable in the service’s Environment tab:
DATABASE_URL=postgresql://test_user:GJRf~r2sTma4umuN~vE6oGWz@dpg-ximnyfiir4kw742sc8cv-rw:5432/testYour app reads DATABASE_URL like any other Postgres host. No special client needed.
From your laptop
Section titled “From your laptop”Use the external URL with the psql CLI:
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.
Credentials
Section titled “Credentials”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.