---
title: "PostgreSQL Deployment"
description: "Run the Enterprise Stack directly on PostgreSQL with databaseType = postgresql."
stack: "Enterprise Stack (commercial) — version 1.2.1"
stack_version: "1.2.1"
stack_comparison: https://docs.walt.id/community-vs-enterprise.md
canonical_url: https://docs.walt.id/enterprise-stack/setup/deployment/postgresql-deployment
generated: 2026-11-11
---
# PostgreSQL Deployment

With `databaseType = postgresql` the Enterprise Stack stores its documents as JSONB in PostgreSQL, one table per collection.
The API connects over JDBC. It does not use the MongoDB wire protocol, and there is no migration from an existing MongoDB
database.

```mermaid
flowchart LR
    A["Enterprise Stack API"] -- "JDBC, port 5432" --> B[("PostgreSQL")]
```

**Note:**

This is not DocumentDB. To run on DocumentDB on PostgreSQL or on Azure DocumentDB through the MongoDB wire protocol, see
[DocumentDB Deployment](https://docs.walt.id/enterprise-stack/setup/deployment/documentdb-deployment.md).

## Prerequisites

Before you begin, ensure you have:

- An Enterprise Stack license, see [Licensing](https://docs.walt.id/enterprise-stack/setup/licensing.md). The API refuses to start without an active license.
- PostgreSQL 18, the version the Enterprise Stack is tested against.
- An empty database and a login that can create tables in it. The API creates and migrates its schema on startup.

## Option 1: Quickstart

For evaluation and development. The [Enterprise Stack Quickstart](https://github.com/walt-id/waltid-enterprise-quickstart#postgresql-instead-of-mongodb)
ships `docker-compose-postgresql.yml`, which runs the API next to a `postgres:18` container:

```bash
docker compose -f docker-compose-postgresql.yml up
```

This stack has no reverse proxy. The API listens on port `7500`, so run the quickstart CLI with `PORT=7500`. To run it next to
the MongoDB stack, set `ENTERPRISE_API_PORT` to another port.

## Option 2: Your Own PostgreSQL

Point the API at the primary in `database.conf`:

```hocon [database.conf]
databaseType = postgresql

postgresql = {
    connectionString = "jdbc:postgresql://{host}:5432/waltid_enterprise?sslmode=verify-full&sslrootcert={caFile}"
    username = "{username}"
    password = "{password}"
}
```

TLS settings go on the JDBC connection string. Pool size, PgBouncer, and the remaining fields are described in
[Database configuration](https://docs.walt.id/enterprise-stack/setup/configurations/config-files/database.md#vanilla-postgresql).

## Limits

- **Primary only.** Point every API replica at the primary. A comma-separated host list is accepted, and the API connects
  only to the primary in it. Reads are not split to replicas.
- **Connections.** A request can hold two connections. Keep `pool.maxSize` (default 24) times the number of replicas,
  times two, under `max_connections`.
- **Licensing.** `usageCheckpointEngine` must stay `true`, the default. The API refuses to start otherwise.
- **Queries.** A filter that cannot be expressed in SQL, such as an arbitrary regular expression, is applied in memory. Such
  a request fails when it would scan more than 10,000 rows.
- **Schema versions.** The API refuses a database whose schema is newer than its own. A database created by an earlier
  preview of this backend is refused too: drop it and start again.

## Start and Verify

A new database has no license state. Activate the license as described in [Licensing](https://docs.walt.id/enterprise-stack/setup/licensing.md). A license
binds to one installation at a time.

The applied schema versions are recorded in the database:

```sql
SELECT version, remark FROM enterprise_schema_migrations ORDER BY version;
```

## Next Steps

- [Database configuration](https://docs.walt.id/enterprise-stack/setup/configurations/config-files/database.md#vanilla-postgresql) — all `postgresql` fields.
- [Licensing](https://docs.walt.id/enterprise-stack/setup/licensing.md) — activate the license for the new database.
- [Docker deployment](https://docs.walt.id/enterprise-stack/setup/deployment/docker-deployment.md) — run the Enterprise Stack image.
- [DocumentDB Deployment](https://docs.walt.id/enterprise-stack/setup/deployment/documentdb-deployment.md) — the MongoDB wire protocol on PostgreSQL.
