Skip to main content
When Neon is connected to an environment, every task gets its own Postgres branch forked from a base branch you pick. The agent can run migrations, seed data, and exercise destructive queries without touching shared environments.

Setup

Open Settings → Environments → [environment] → Database. Paste a project-scoped Neon API key (starts with napi_), verify it, then configure:
  • Parent branch: the Neon branch new task branches fork from. Defaults to your project’s primary branch (typically main).
  • Environment variable: name of the env var the connection string is injected as. Defaults to DATABASE_URL.
  • TTL (days): how long Neon keeps the branch around. Default 30.
  • Delete on task archival: drop the branch when the task is archived (e.g. after PR merge). Default on.

Branch lifecycle

When a task starts, Niteshift creates a fresh Neon branch forked from the parent branch and injects the connection string into the environment under your chosen variable name. Your setup can read the connection string and run migrations against the new branch before the agent starts work:
Resumed tasks reuse the same branch they had before, so state survives across pause-resume. Branches are deleted when the task is archived (if enabled) or when the TTL expires.
If a long-running task outlives its branch’s TTL, the next run forks a new branch from the parent. Raise the TTL if you need the same branch to persist longer.