PostgreSQL

Add Postgres in dFlow, deploy it, copy your connection string or wire it with reference variables, and optionally expose it to the internet.

Written By Team dFlow

Last updated 3 days ago

Postgres (PostgreSQL) is a reliable, full-featured SQL database, great for most apps that need tables, joins, and strong consistency. In dFlow the picker label is Postgres; behavior is the same as PostgreSQL you know elsewhere.

New to databases in dFlow? Start with the Databases overview for the big picture.


On this page

  • When Postgres is a good fit

  • Creating and deploying Postgres in the dashboard

  • Where your URL and password appear

  • Connecting your app without pasting secrets

  • Optional internet access (Expose)

  • Restart and stop


When to choose Postgres

Choose Postgres when you want a general-purpose relational database: structured data, SQL reporting, transactions, and extensions. If you specifically need MySQL compatibility, consider MariaDB or MySQL instead.


Set up Postgres in dFlow

  1. Go to Applications β†’ your app β†’ Environment.

  2. Click Add New β†’ Add service β†’ Database β†’ Postgres.

  3. Give the service a clear name (you’ll use it in reference variables).

  4. Click Create Service, open the service, then click Deploy.

  5. Wait until Deploy finishes successfully. dFlow sets up whatever the server needs automatically. You don’t install anything by hand.


Your connection details

On the database Overview, after deploy succeeds:

  • Connection URL: a full postgres://… link you can paste into tools that accept a URL.

  • Username, password, hostname, port, database name: same information broken out for drivers that want separate fields.

Use these internal values for apps and services in the same environment.

Public URL, host, and port only appear after you click Expose (see below). If you exposed the database, click Unexpose before Stop.


Link your app with reference variables

Instead of copying the password into an env field by hand, use Reference variables in your app or Docker service:

  1. Open the app or Docker service β†’ Variables tab.

  2. Click the { } button next to a value.

  3. Pick your Postgres service and the field you need.

Tokens use your database service name and the word POSTGRES in the middle. For example, if the service is named orders-db:

{{ orders-db.POSTGRES_URI }}

Suffix

What it fills in

_URI

Full internal connection URL

_NAME

Database name

_USERNAME

User name

_PASSWORD

Password

_HOST

Internal host

_PORT

Internal port

_PUBLIC_HOST, _PUBLIC_PORT, _PUBLIC_URI

Only after Expose

Options with PUBLIC in the name stay disabled until the database is deployed and exposed.


Internet access (Expose)

Use Expose when something outside dFlow must connect (CI, local tools, another network). dFlow opens one public port for Postgres and shows Public credentials on Overview.

Use Unexpose to close public access. You must Unexpose before Stop if the database was exposed.


Day-to-day management

  • Deploy: first-time setup; later deploys follow the same flow as other database services.

  • Restart / Stop: lifecycle controls on the server. The dashboard prevents actions that would break running databases (for example removing shared engine support while services still use it).


Useful links