
- Provision a Postgres instance (local container, Docker Compose, or a managed cloud database).
- Update Backstage’s
app-config.yamlto point to the Postgres instance. - Initialize the database schema by running Backstage database migrations.
- Start Backstage with the environment variables or configuration in place so it can connect to Postgres.
backend.database section under your backend configuration in app-config.yaml. This tells Backstage to use the pg client (node-postgres) and to read connection details from environment variables:
You can supply a single connection string instead of individual fields:
After configuring the connection, run Backstage’s database migrations to create required tables and schemas. The exact migration command depends on your repository (check package.json scripts or README). Run migrations before starting Backstage in production to avoid runtime schema errors.
- Use strong credentials and store them in a secrets manager or environment variables — do not commit credentials to source control.
- Restrict network access to the database (VPCs, security groups, or private networks).
- Enable SSL/TLS for connections when using remote or managed Postgres services.
- Regularly back up your Postgres data and test restore procedures.
- For production, prefer a managed or highly available Postgres offering (for example, AWS RDS, Google Cloud SQL, or a clustered deployment).
Do not run production Backstage against an ephemeral or in-memory database. Data loss can occur on process restarts. Also ensure your migration strategy is part of your deployment pipeline to avoid schema drift.
Links and references
With the database configured and migrations applied, Backstage will persist entities and other state to Postgres instead of using an ephemeral in-memory store.