Add a database
In a project, click Add service → Database and pick one:
| Database | Image | Port | Variable with the connection string |
|---|---|---|---|
| PostgreSQL | postgres:17 | 5432 | DATABASE_URL |
| MySQL | mysql:8 | 3306 | MYSQL_URL |
| Redis | redis:7 | 6379 | REDIS_URL |
| MongoDB | mongo:7 | 27017 | MONGO_URL |
Each one gets a generated password and a volume so data survives restarts and redeploys.
Connect it to your app
On your app's Variables tab, add a variable that points at the database:
DATABASE_URL=${{Postgres.DATABASE_URL}}The part before the dot is the database service's name, and the part after is the variable on it. When your app deploys, the reference is swapped for the real value. If you rename the database, update the reference.
Connection details
Open the database → Database tab to see the private address, the connection URL (hidden until you click the eye) and the tables or keys inside.
Databases are only reachable from services on the same server. They aren't exposed to the internet.
Backups
Scheduled backups are on the way. Until then, export your data with the database's own tool, for example:
pg_dump "$DATABASE_URL" > backup.sql