Add and connect databases

A Postgres or MySQL database in your project, connected to your app with DATABASE_URL, with backups.

A database at Cubli lives in your project, has no public address and is backed up to another country by itself. It grows with its data, within your plan. Databases are in Standard and up, not in Static.

Add a database

  1. Open your project. In an empty project, choose Database; if something is already in it, right-click the canvas in the advanced view and choose Database.
  2. Choose the kind:
    • Postgres 18: for most apps, such as Node, Next.js and Python.
    • MySQL (MariaDB 11.8): for WordPress and other PHP apps.
  3. Give it a name, or let Cubli choose one (db, db2).
  4. Click Place on canvas.

Your AI tool can do this too, with create_database.

Connect it to your app

Draw a line on the canvas from the database to your app. Or open the database, pick your app under Connected apps in Choose an app… and click Connect.

Your app restarts and gets these variables:

Database Variables
Postgres DATABASE_URL, PGHOST, PGUSER, PGPASSWORD
MySQL DATABASE_URL, MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD

In your code, just use process.env.DATABASE_URL (or however your language reads environment variables). The variables are listed on your app under Variables, in From connected databases, and kept up to date automatically.

Disconnect a database with Disconnect and the variables go from that app.

Reachability

A database is only reachable from inside your own project. You cannot reach it directly from your own computer or another host. So data goes in or out as a dump:

Backups

  • Postgres: every change, kept for 14 days. You can go back to any moment in those 14 days.
  • MySQL: every 6 hours, kept for 14 days.

The backups are in a data centre in another country. You cannot yet restore a backup yourself from the dashboard: mail support@cubli.io and Cubli support restores it for you.

Staging

On staging, every database has a twin of its own, with its own data. What you do on staging does not touch production. See Staging, promote and roll back.

Was this helpful?

Stuck? Mail support@cubli.io, or ask from your dashboard: Help