Skip to main content
Version: Next

Database

The Reference Implementation uses a PostgreSQL database to store all of its data — tenants, users, service registrations, credentials metadata, configuration, and more. See System Architecture for what the database contains and how it relates to the external services.

Provisioning

When using the Docker Compose configuration from the repository, a PostgreSQL instance (ri-db) is provisioned automatically. Organisations using the Reference Implementation Docker image directly will need to provision their own PostgreSQL instance (version 17 or later recommended).

Configuration

The following environment variables must be passed to the Reference Implementation to configure the database connection:

VariableRequiredDescriptionDefault
RI_POSTGRES_HOSTYesDatabase hostname
RI_POSTGRES_PORTNoDatabase port5432
RI_POSTGRES_USERNoDatabase userpostgres
RI_POSTGRES_PASSWORDNoDatabase passwordpostgres
RI_POSTGRES_DBNoDatabase nameri

Migrations and Seeding

On startup, the Reference Implementation automatically applies database migrations and seeds system default records. See Startup for the full sequence, what gets seeded, and how to control each step.

Local Development

For local development, the Prisma CLI provides useful tools:

cd packages/reference-implementation

# Visual database editor
yarn prisma studio

# Create and apply a new migration
yarn prisma migrate dev