> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dbhost.app/llms.txt
> Use this file to discover all available pages before exploring further.

# DBHost core concepts: databases, pooling, backups, roles

> How DBHost works: shared PostgreSQL host, PgBouncer pooling on port 6432, backups, API keys, team roles and customer webhooks explained.

## Databases

A database in DBHost is a PostgreSQL database with its own SQL access and
PgBouncer pool slot. Customer databases share the same PostgreSQL host and
its CPU, memory, and disk; separate SQL roles and database grants do not
provide hard resource isolation. Owners can also share dashboard access with
other DBHost users through database-level memberships.

DBHost checks shared-node connection and resource headroom before adding a
new database route. These checks can defer new database creation when the node
is under pressure; they do not impose a hard per-database CPU, memory or disk
quota on existing databases.

When you create a database from the dashboard, DBHost generates an internal
PostgreSQL identifier from your display name and account. With the optional
**Managed SQL roles** choice, the database gets separate generated owner,
runtime, and read-only usernames; the database name is not a role username.
Without that choice, the legacy login uses the internal database name as its
username. On paid plans the public API accepts a database name using lowercase
letters, numbers, and hyphens; its managed-create endpoint requires a
full-account API key.

Dashboard lists can therefore contain:

* **Owned databases** — full owner control
* **Shared databases** — access granted by another owner, shown with your effective access role

## PgBouncer

Every database connection goes through [PgBouncer](https://www.pgbouncer.org/), a lightweight connection pooler. This means:

* **Lower overhead** — PgBouncer multiplexes many client connections onto fewer PostgreSQL backend connections
* **Port 6432** — Applications connect on port 6432. The only exception is the
  short-lived [direct migration connection](https://docs.dbhost.app/guides/direct-migrations.md) on
  `migrate.dbhost.app:5432`
* **Transaction pooling** — Ordinary application queries use PgBouncer;
  session features and some migration tools need the direct migration
  connection instead
* **Server connection cap** — PgBouncer opens at most the plan's default
  number of server connections per database (Free 2, Pro 3, Business 4),
  adjustable up to the plan maximum; see
  [Connection limits and timeouts](https://docs.dbhost.app/guides/connection-limits-and-timeouts.md)
* **Network policy enforcement** — per-database IP allowlists are applied at the PgBouncer layer
* **Lifecycle coordination** — start, stop, restart, and password resets flow through PgBouncer as well as PostgreSQL

## Backups

Backups use `pg_dump` piped through `gzip`. In production, DBHost stores durable logical backups off-host in AWS S3 `eu-north-1` as `.sql.gz` files, while the VPS only keeps temporary working files during backup creation. New production databases default to daily scheduled logical backup; staging also defaults to daily, while development and other databases require an explicit `none` or `daily` choice. A `none` choice disables only scheduled logical backups. Enabled normal history is retained for 30 days, with no guaranteed backup time. Existing databases keep their prior daily policy when their environment label changes. Preview CI databases have no daily logical backup by default and can choose daily instead. Authorized roles can also trigger backups manually from the dashboard or API.

Backup files are named with UTC timestamps: `20260319_120000.sql.gz`.
Internal/system databases are excluded from the scheduled run. Dashboard
on-demand backups are available on every plan; API and CLI triggers require Pro
or Business.

The verified backup created for database deletion is an explicit exception to
normal 30-day retention. It remains available for the seven-day deleted
database recovery window. Afterwards, DBHost permanently deletes the database
and its deletion backup automatically. See
[Backups and retention](https://docs.dbhost.app/backups-and-retention.md).

Infrastructure VM backups and manually retained snapshots are separate disk
copies. They may contain preview data even when daily logical backup is off and
do not expire when a preview lease ends. DBHost retains the three newest
manual tenant-node snapshots and removes older ones after a protected restart
is committed and verified. This is a rolling count, not an age-based expiry
for an individual preview.

DBHost-produced backups can be restored in place into the same database; see
[Restore from a DBHost backup](https://docs.dbhost.app/guides/restore-from-backup.md). DBHost does not
restore uploaded dumps; import them yourself with
[psql or pg\_restore](https://docs.dbhost.app/guides/restore-your-own-dump.md).

## User identity

DBHost treats one verified primary email as one logical account.

If Clerk issues a new user ID for the same verified primary email, DBHost reclaims the account instead of creating a second local user record. Databases, API keys, and subscriptions move to the new identity automatically. Historical audit-log actor IDs are preserved.

## API keys

Pro and Business users can create API keys for programmatic access to the
DBHost REST API. Each key has:

* A **prefix** (visible, for identification)
* A **hashed secret** (stored securely, shown only once when created or replaced)
* A **label** (your description)
* A **scope mode** (`all` or `selected`, shown in the UI as `Full account access` or `Selected databases`)
* **Last used** timestamp

Use API keys with the `Authorization: Bearer <key>` header.

Selected-database keys only list and operate on the databases assigned to them. Full-account keys can create and manage every database in the owning account.

## Security boundaries

DBHost hardens the path between the dashboard and the VPS agent in a few specific ways:

* **Stored tenant database passwords are encrypted at rest** in the control-plane database
* **The in-dashboard SQL Explorer is owner-only and read-only**, and runs through a dedicated PostgreSQL explorer role
* **Customer-facing operations only act on registered customer databases**, so internal databases such as `dbhost` are outside that surface
* **Public API routes enforce request budgets and request-size caps**, which makes direct HTTP abuse and noisy automation harder to sustain

These controls are additive. Direct PostgreSQL connections still use the normal database credentials shown on the detail page, while the explorer keeps its own tighter boundary.

## Database collaboration

Database access has its own role system, separate from the platform-wide `user` / `admin` role.

| Database role | Access |
| - | - |
| **owner** | Full control, including delete, sharing, lifecycle, backups, read-only explorer, credentials, IP allowlist, and activity |
| **admin** | Manage collaborators, lifecycle, credentials, backups, connection activity, and IP allowlist |
| **developer** | View credentials and view/download backups; cannot trigger, restore, or delete backups |
| **viewer** | View the detail page and connection activity, but cannot use the explorer, credentials, or write actions |

Dashboard roles are separate from PostgreSQL roles such as owner, runtime and
read-only; see [Database roles](https://docs.dbhost.app/guides/database-roles.md).

Existing DBHost users receive membership directly. For an unknown email, the
pending-invitation flow stores a local DBHost row and sends a seven-day Clerk
invitation. Acceptance during first sign-in is idempotent; database/role data
is not stored in Clerk public metadata.

## Activity log

Every significant action is recorded in the activity log with:

* **Who** performed the action (user ID)
* **What** action was taken (create, delete, reset\_password, etc.)
* **Which** resource was affected (database name, user ID)
* **When** it happened
* **Details** (JSONB, action-specific context)

Users can review account and database activity in the dashboard. Platform operators have a separate internal audit view for full-platform administration.

## System incidents

Operational failures are tracked separately from actor-driven activity so DBHost can distinguish system health issues from user actions.

This includes:

* render/runtime failures
* public API failures
* agent reachability problems
* backup failures or stale backups
* watchdog-generated health incidents

Platform operators use a private internal admin surface to inspect and manage these incidents.

## Customer operation webhooks

Webhook v1 sends `<type>.<succeeded|failed|canceled>` events for backup,
restore, clone, delete, recover, and extension operations; see
[Webhooks](https://docs.dbhost.app/api-reference/webhooks.md). Deliveries use a stable event ID and a timestamped
HMAC-SHA256 signature. Secrets are encrypted at rest and shown only at
create/rotate time.

Endpoints must use public HTTPS. DBHost rejects localhost, private/link-local
addresses, unsafe redirects, and DNS-rebinding targets. Deliveries use bounded
retries with jitter and a delivery ledger; permanently failing endpoints can be
disabled automatically.

## Platform roles

DBHost also has two platform-wide roles:

| Role | Access |
| - | - |
| **user** | Own databases, own activity history, own API keys, own settings |
| **admin** | Everything above plus platform administration, moderation, health monitoring, and incident response |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.