CapyDB Docs
Guides

Preview databases

Disposable Postgres databases for testing, review apps, debugging, and other controlled forms of chaos.

Modes

  • empty creates a fresh, blank preview database
  • clone creates a preview from the current state of the project database

Both expose the same direct and pooled connection pattern as the main project, with their own generated credentials.

Lifecycle and TTL

Every preview carries a TTL: 24 hours by default, 168 hours (7 days) maximum. When the TTL expires the worker deletes the preview — that is the backstop that keeps forgotten review databases from accumulating.

You can extend a running preview's TTL, reset it (re-clone or re-empty), or delete it early. Create, reset, restore-into, and delete are all tracked as separate jobs from primary project jobs.

The number of concurrent previews per project is plan-dependent: 1 on Vibe, 5 on Ship, unlimited on Business.

From the dashboard

The Previews tab on a project lists previews with state, mode, TTL expiry, and connection details, plus create/reset/extend/delete actions.

From the CLI

capydb preview create --mode clone --name pr-42 --ttl-hours 72 --wait
capydb preview list
capydb preview reset --preview pr-42 --wait
capydb preview extend <preview-id> --ttl-hours 48
capydb preview delete --preview pr-42 --wait

Then connect to it directly:

capydb psql --preview <preview-id>
capydb connection-string --preview <preview-id> --pooled

From CI

The GitHub Action creates an idempotent preview per pull request and exports DATABASE_URL / DATABASE_URL_UNPOOLED into the job. The Vercel and Netlify integrations create a preview per git branch automatically.

Restoring into previews

Previews double as the safe restore target: a restore can land in a brand-new preview or overwrite an existing one, which is how you inspect a backup or a point-in-time state without touching production.

Promoting a preview

When a preview is the state you want in production — a rehearsed migration, a restructured dataset — that is a cutover: an operator-assisted promotion with a verified pre-cutover backup taken first.

Webhook events

preview.ready and preview.deleted fire as webhook events when previews come and go.