CapyDB Docs
GuidesIntegrations

Netlify

Same shape as the Vercel integration - site ID plus personal access token, deploy hooks, branch-context env vars.

What it does

Connect a CapyDB project to a Netlify site and CapyDB will:

  • validate the personal access token and bind to the site
  • push DATABASE_URL (pooled) and DATABASE_URL_UNPOOLED (direct) into the site's environment variables
  • re-push automatically after credential rotation, restores, and imports
  • register a deploy_building notification hook (when preview branches are enabled)
  • create a preview database per branch deploy: clone mode, named branch-<slug>, with connection strings set as branch-context env vars
  • refresh the preview's TTL on each branch deploy; cleanup stays TTL-driven

Setup

Dashboard → project → Settings → Integrations → Netlify:

  1. Create a Netlify personal access token (Netlify → User settings → Applications → Personal access tokens).
  2. Enter the site ID (Site configuration → Site details → "Site ID") and the token. The token is stored encrypted and never returned.
  3. Optionally enable preview branches.

CapyDB validates the token against the Netlify API before saving, then runs an immediate env sync.

Branch deploys in practice

When a branch or deploy-preview build starts, Netlify fires the deploy_building hook. Production-context builds are ignored; for anything else CapyDB ensures the branch-<slug> preview exists and pushes its URLs scoped to that branch's deploy context.

The same first-build caveat as Vercel applies: the very first build of a new branch may start before the branch-scoped env var exists. The GitHub Action gives you exact ordering when that matters.

CLI escape hatch

capydb integrations env --target netlify --netlify-context branch-deploy

prints the env payload for any Netlify deploy context (all, dev, branch-deploy, deploy-preview, production, or branch).