---
title: "Supabase"
description: "Give every run its own isolated Supabase preview branch, wired into the sandbox through .trevize/settings.json."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.trevize.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase

Connecting **Supabase** lets Trevize provision an **isolated preview branch for
every run** — its own branch of your Supabase project's database — so agents and
previews work against realistic data. The branch is torn down when the run's
sandbox is cleaned up.

> **Requires branching**
>
> Supabase branching requires a paid Supabase plan with branching enabled on the
> project you connect.

## Connect Supabase

1. **Authorize**

   Choose **Connect Supabase**. A popup opens where you authorize Trevize with your
   Supabase organization and pick which organization to grant access to.

2. **Choose a project**

   Once connected, select the **project** runs should branch from and save the
   configuration. Use **Reconnect** to switch organizations, or **Disconnect** to
   stop provisioning branches.

## Use it in a repository

Declare the resource in a repository's [`.trevize/settings.json`](/configuration),
mapping your app's database environment variable to the one Trevize provides:

```json
{
  "resources": {
"supabase": {
  "env": {
    "DATABASE_URL": "SUPABASE_DATABASE_URL"
  }
}
  }
}
```

For each run, Trevize provisions a preview branch and injects
`SUPABASE_DATABASE_URL`, `SUPABASE_BRANCH_ID`, and `SUPABASE_BRANCH_REF` into the
sandbox. The mapping above sets your app's `DATABASE_URL` from
`SUPABASE_DATABASE_URL`. The settings page shows, per repository, whether the
resource is **configured** and the env mapping in effect.

> **Let an agent wire it up**
>
> The Supabase settings page can copy a setup prompt that detects your app's
> actual Postgres environment variable and generates the correct `resources`
> block. See [Resources configuration](/configuration).

Source: https://docs.trevize.dev/integrations/supabase/index.mdx
