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
Go to Applications β your app β Environment.
Click Add New β Add service β Database β Postgres.
Give the service a clear name (youβll use it in reference variables).
Click Create Service, open the service, then click Deploy.
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:
Open the app or Docker service β Variables tab.
Click the
{ }button next to a value.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 }}
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).