Databases

Add Postgres, MySQL, Redis or MongoDB to a project in one click: + Create → Database on the project's canvas, then the one you want. It sits on the canvas beside the apps that use it, set up the way a database should be:

Connecting an app

Open the database and its Connect tab, choose your app and click Connect. The app gets one variable and is deployed with it:

DatabaseVariableLooks like
PostgresDATABASE_URLpostgres://app:…@postgres:5432/app
MySQLDATABASE_URLmysql://app:…@mysql:3306/app
RedisREDIS_URLredis://default:…@redis:6379
MongoDBMONGODB_URImongodb://app:…@mongodb:27017/app

What's stored on the app is a reference, ${{postgres.DATABASE_URL}}, not a copy of the URL. The app follows the database: change its password and the app has the new one with its next deploy, and the password is never pasted anywhere it could go stale.

To use it in a variable of your own (a framework that wants the host and port apart, say), reference what you need: ${{postgres.HOST}}, ${{postgres.PORT}}, ${{postgres.POSTGRES_PASSWORD}}.

A second database of the same kind gets a name of its own: postgres-2, with its own password and its own URL.

Working with it

A prompt in it, a GUI client or a migration from your own machine, and backups: working with a database and backups.

Good to know