Client Area

PostgreSQL Database

2 min readPublished 6 Apr 2026Updated 22 Aug 2026309 views

In this article

  • 1How your app connects
  • 2Backups
  • 3Migrations
  • 4Limits
  • 5If your app cannot reach its database

PostgreSQL Database

Every App Platform plan includes a managed PostgreSQL 16 database.

How your app connects

The database is created automatically with your app. Its connection string is injected as the DATABASE_URL environment variable — you do not configure anything.

postgresql://user:password@host:5432/dbname

Node.js (Prisma):

javascript
// prisma/schema.prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Python (SQLAlchemy):

python
import os
from sqlalchemy import create_engine
engine = create_engine(os.environ['DATABASE_URL'])

Go:

go
db, err := sql.Open("postgres", os.Getenv("DATABASE_URL"))

DATABASE_URL is a system variable. It cannot be edited or deleted, and it is re-applied on every deploy. To use a database you host elsewhere, add your own variable under a different name instead — see Environment Variables.

Backups

Your database is backed up automatically every night, and you can take a

backup yourself at any time.

To take one now:

  1. Open your app and go to the Backups tab
  2. Click Create Backup

To restore:

  1. Go to the Backups tab
  2. Choose the backup you want and click Restore

Restoring replaces your current database. You will be asked to confirm.

Take a fresh backup first if the current data still matters.

We keep your 7 most recent backups. Even with nightly backups running, it is

worth taking one yourself immediately before a schema migration, a bulk delete,

or a major release — that way your recovery point is exactly where you want it.

Migrations

Run migrations automatically at deploy time using a release step in your Procfile:

release: npx prisma migrate deploy
web: node server.js

The release process runs once, before the web process starts.

Limits

  • One database per app
  • No direct connection from your own machine — your app reaches the database internally
  • Database size counts towards your plan's storage allowance

If your app cannot reach its database

Do not change DATABASE_URL — the value we inject is correct. If your app cannot connect, check the Logs tab for the exact error and open a ticket with your app name. A connection failure on a correctly injected DATABASE_URL is something for us to fix, not you.

Was this article helpful?

Your feedback helps us improve our documentation

Still need help? Submit a support ticket

PostgreSQL Database - Knowledge Base