Skip to content

Resources

Provision managed resources like a database branch per run and map their connection details into your app's environment.

Updated View as Markdown

The resources block wires managed resources — like an isolated database branch — into each run’s sandbox. It’s the repo-side half of the Neon and Supabase integrations: the integration connects the provider at the workspace level, and resources declares that this repository wants a branch and how to expose it.

How it works

Each entry under resources is keyed by the integration id and has an env map that translates the variable Trevize provides into the variable your app expects:

{
  "resources": {
    "neon": {
      "env": {
        "DATABASE_URL": "NEON_DATABASE_URL"
      }
    }
  }
}

Read the mapping as "<your app's variable>": "<the variable Trevize provides>". Above, your app’s DATABASE_URL is set from the NEON_DATABASE_URL that Trevize injects for the run’s branch.

Provided variables

For each declared resource, Trevize provisions a fresh branch per run and injects these variables into the sandbox (map whichever ones your app needs):

Resource Injected variables
neon NEON_DATABASE_URL, NEON_BRANCH_ID
supabase SUPABASE_DATABASE_URL, SUPABASE_BRANCH_ID, SUPABASE_BRANCH_REF

You can also compose these variables in a preview process’s env — for example "${NEON_DATABASE_URL}?connection_limit=5".

Mapping more than one variable

Map as many app variables to a provided variable as you need:

{
  "resources": {
    "neon": {
      "env": {
        "DATABASE_URL": "NEON_DATABASE_URL",
        "DIRECT_URL": "NEON_DATABASE_URL"
      }
    }
  }
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close