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) andDATABASE_URL_UNPOOLED(direct) into the site's environment variables - push
CAPYKV_REST_URLwhen the project has a K/V store - the URL only. The K/V token is shown once when you create or rotate it and is never retrievable, so setCAPYKV_REST_TOKENyourself - re-push automatically after credential rotation, restores, and imports
- register a
deploy_buildingnotification 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:
- Create a Netlify personal access token (Netlify → User settings → Applications → Personal access tokens).
- Enter the site ID (Site configuration → Site details → "Site ID") and the token. The token is stored encrypted and never returned.
- Optionally enable preview branches.
CapyDB validates the token against the Netlify API before saving, then runs an immediate env sync.
Or from the repo, after netlify link:
NETLIFY_AUTH_TOKEN=... capydb env sync netlify --preview-branchesIt reads the site from .netlify/state.json (or --site), connects the same integration, and waits for the first push.
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.
Re-push on demand
If DATABASE_URL was deleted or edited on the Netlify side, or a push failed, push the current values again without reconnecting:
curl -X POST https://capydb.dev/api/capydb/v1/projects/$PROJECT_ID/integrations/netlify/sync \
-H "Authorization: Bearer $CAPYDB_API_KEY"It queues a job (202) that pushes the same variables connecting pushed, with the token stored when you connected. 404 means the project has no Netlify integration; 409 means a push for it is already queued or running - wait for that one. Needs projects:write. Recorded in the audit log as project.integration.env_synced.
CLI escape hatch
capydb integrations env --target netlify --netlify-context branch-deployprints the env payload for any Netlify deploy context (all, dev, branch-deploy, deploy-preview, production, or branch).