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

# Supabase

> SQL, migrations, logs, branches, and project metadata.

Supabase is included in Archal's environment catalog. Use it in a sandbox for SQL, migrations, logs, branches, and project metadata.

|                 |                                                 |
| --------------- | ----------------------------------------------- |
| Environment ID  | `supabase`                                      |
| Transport       | REST and MCP                                    |
| State           | JSON or SQL                                     |
| Contract        | `archal.environment-state.supabase` version `1` |
| Channel         | Public                                          |
| Curated samples | 5                                               |

Public is the intended GA channel. It still describes a bounded provider surface, not a promise that every upstream operation exists.

## Compatibility boundary

**Local catalog validation:** All five published samples passed. Checks cover the state contract, relationships, artifact hash, secret scan, and size limit.

<Note>
  Local catalog validation is not hosted proof. Archal checks current certification, reset, and isolation evidence before admitting new sandboxes. Use the authenticated environment catalog for live availability.
</Note>

* SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

## Curated starting states

List the five samples with `archal sample list supabase`. Each sample is a versioned starting state with a representative read, mutation, expected diff, reset expectation, and verified artifact hash.

<AccordionGroup>
  <Accordion title="Supabase connector baseline">
    Read one operator in a minimal Slack-connection schema, then insert and reset a second user.

    **Sample ID:** `supabase.small-relational-project.v1`

    **Category:** `minimal`

    **Starting state:** 4 records across `provider_connections`: 1, `supabase_migrations.schema_migrations`: 1, `sync_runs`: 1, `users`: 1

    **Supported surface:** PostgreSQL schema and fixture states with REST data-plane reads and writes.

    **Required capabilities:** `state.read`, `state.load.sql`, `state.reset`, `rest.tables`

    **First read:** `GET /rest/v1/users?select=*`. Expected result: HTTP 200.

    **Representative mutation:** `POST /rest/v1/users`. Expected result: HTTP 200, 201, 204.

    **Mutation input**

    ```json theme={null}
    {
      "email": "jordan.lee@example.test",
      "name": "Jordan Lee"
    }
    ```

    **Expected diff:** changes include `database.tables`. Exact match required: no. Hosted promotion must observe every listed path after the provider-native mutation; dynamic provider ids and timestamps are excluded from exact matching.

    **Expected reset:** restores original session seed.

    **Known limits**

    * SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

    **Start this sample**

    ```bash theme={null}
    archal sample show supabase.small-relational-project.v1 --raw > archal-supabase-small-relational-project.sql
    archal state validate supabase archal-supabase-small-relational-project.sql
    archal session create supabase \
      --state supabase=archal-supabase-small-relational-project.sql
    ```

    **Inspect the raw state**

    ```bash theme={null}
    archal sample show supabase.small-relational-project.v1 --raw
    ```

    The packaged SQL artifact is `samples/states/supabase/small-relational-project/state.sql` and is 1,981 bytes. The CLI verifies SHA-256 `00b34ef0edd876c64bbf5fd06611cacfaf58f7013c17c0befd0933591d49a050` before printing it.

    Catalog validation: **Passed**. Hosted availability is determined by Archal's live certification and admission system, not this static page.
  </Accordion>

  <Accordion title="Supabase SaaS team">
    Exercise users, profiles, subscriptions, teams, memberships, RLS policies, trigger, and migration metadata.

    **Sample ID:** `supabase.saas-team.v1`

    **Category:** `small-team`

    **Starting state:** 16 records across `profiles`: 1, `subscriptions`: 5, `team_members`: 3, `teams`: 2, `users`: 5

    **Supported surface:** PostgreSQL schema and fixture states with REST data-plane reads and writes.

    **Required capabilities:** `state.read`, `state.load.sql`, `state.reset`, `rest.tables`

    **First read:** `GET /rest/v1/users?select=*`. Expected result: HTTP 200.

    **Representative mutation:** `POST /rest/v1/users`. Expected result: HTTP 200, 201, 204.

    **Mutation input**

    ```json theme={null}
    {
      "email": "maya.chen@example.test",
      "full_name": "Maya Chen"
    }
    ```

    **Expected diff:** changes include `database.tables`. Exact match required: no. Hosted promotion must observe every listed path after the provider-native mutation; dynamic provider ids and timestamps are excluded from exact matching.

    **Expected reset:** restores original session seed.

    **Known limits**

    * SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

    **Start this sample**

    ```bash theme={null}
    archal sample show supabase.saas-team.v1 --raw > archal-supabase-saas-team.sql
    archal state validate supabase archal-supabase-saas-team.sql
    archal session create supabase \
      --state supabase=archal-supabase-saas-team.sql
    ```

    **Inspect the raw state**

    ```bash theme={null}
    archal sample show supabase.saas-team.v1 --raw
    ```

    The packaged SQL artifact is `samples/states/supabase/saas-team/state.sql` and is 6,676 bytes. The CLI verifies SHA-256 `70b33b36f4abe76466fb040b0cdb5edc9d798beb0cb22845eb2d6a3c57b6f6f1` before printing it.

    Catalog validation: **Passed**. Hosted availability is determined by Archal's live certification and admission system, not this static page.
  </Accordion>

  <Accordion title="Supabase populated ecommerce database">
    Exercise production and test tables for users, products, orders, payments, subscriptions, migrations, and indexes.

    **Sample ID:** `supabase.ecommerce-database.v1`

    **Category:** `populated`

    **Starting state:** 132 records across `_migration_test`: 3, `_seed_data`: 5, `orders`: 30, `payments`: 25, `products`: 15, `subscriptions`: 15, `supabase_migrations.schema_migrations`: 3, `test_orders`: 6, `test_payments`: 4, `test_users`: 6, `users`: 20

    **Supported surface:** PostgreSQL schema and fixture states with REST data-plane reads and writes.

    **Required capabilities:** `state.read`, `state.load.sql`, `state.reset`, `rest.tables`

    **First read:** `GET /rest/v1/users?select=*`. Expected result: HTTP 200.

    **Representative mutation:** `POST /rest/v1/users`. Expected result: HTTP 200, 201, 204.

    **Mutation input**

    ```json theme={null}
    {
      "email": "maya.chen@example.test",
      "name": "Maya Chen"
    }
    ```

    **Expected diff:** changes include `database.tables`. Exact match required: no. Hosted promotion must observe every listed path after the provider-native mutation; dynamic provider ids and timestamps are excluded from exact matching.

    **Expected reset:** restores original session seed.

    **Known limits**

    * SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

    **Start this sample**

    ```bash theme={null}
    archal sample show supabase.ecommerce-database.v1 --raw > archal-supabase-ecommerce-database.sql
    archal state validate supabase archal-supabase-ecommerce-database.sql
    archal session create supabase \
      --state supabase=archal-supabase-ecommerce-database.sql
    ```

    **Inspect the raw state**

    ```bash theme={null}
    archal sample show supabase.ecommerce-database.v1 --raw
    ```

    The packaged SQL artifact is `samples/states/supabase/ecommerce-database/state.sql` and is 12,802 bytes. The CLI verifies SHA-256 `073226192a4dc49294c2b834d2434cb3bdd3558e11e0055b5b8a9f23facd37a3` before printing it.

    Catalog validation: **Passed**. Hosted availability is determined by Archal's live certification and admission system, not this static page.
  </Accordion>

  <Accordion title="Supabase terminated/contractor identity collision">
    Read a terminated employee and active contractor sharing a name, then insert a third distinct partner identity without conflating keys.

    **Sample ID:** `supabase.terminated-contractor-identity.v1`

    **Category:** `edge-case`

    **Starting state:** 18 records across `customer_exports`: 4, `ui_copy_strings`: 8, `users`: 6

    **Supported surface:** PostgreSQL schema and fixture states with REST data-plane reads and writes.

    **Required capabilities:** `state.read`, `state.load.sql`, `state.reset`, `rest.tables`

    **First read:** `GET /rest/v1/users?select=*&name=eq.Dana%20Wu`. Expected result: HTTP 200.

    **Representative mutation:** `POST /rest/v1/users`. Expected result: HTTP 200, 201, 204.

    **Mutation input**

    ```json theme={null}
    {
      "contractor_id": "P-220",
      "department": "Partner Operations",
      "email": "dana.wu@partner.example.test",
      "employee_id": null,
      "name": "Dana Wu",
      "role": "partner",
      "status": "active",
      "terminated_at": null
    }
    ```

    **Expected diff:** changes include `database.tables`. Exact match required: no. Hosted promotion must observe every listed path after the provider-native mutation; dynamic provider ids and timestamps are excluded from exact matching.

    **Expected reset:** restores original session seed.

    **Known limits**

    * SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

    **Start this sample**

    ```bash theme={null}
    archal sample show supabase.terminated-contractor-identity.v1 --raw > archal-supabase-terminated-contractor-identity.sql
    archal state validate supabase archal-supabase-terminated-contractor-identity.sql
    archal session create supabase \
      --state supabase=archal-supabase-terminated-contractor-identity.sql
    ```

    **Inspect the raw state**

    ```bash theme={null}
    archal sample show supabase.terminated-contractor-identity.v1 --raw
    ```

    The packaged SQL artifact is `samples/states/supabase/terminated-contractor-identity/state.sql` and is 4,549 bytes. The CLI verifies SHA-256 `83e1f770c1e404f047d491446c332667eb8655ded4c884c49e5adcbae87ae146` before printing it.

    Catalog validation: **Passed**. Hosted availability is determined by Archal's live certification and admission system, not this static page.
  </Accordion>

  <Accordion title="Supabase Vaultline cart workflow">
    Start from RLS-backed profiles, products, and cart items with a closed product foreign key, then insert and reset one profile row.

    **Sample ID:** `supabase.vaultline-cart-workflow.v1`

    **Category:** `workflow`

    **Starting state:** 21 records across `cart_items`: 5, `products`: 7, `profiles`: 6, `supabase_migrations.schema_migrations`: 3

    **Supported surface:** PostgreSQL schema and fixture states with REST data-plane reads and writes.

    **Required capabilities:** `state.read`, `state.load.sql`, `state.reset`, `rest.tables`

    **First read:** `GET /rest/v1/profiles?select=*`. Expected result: HTTP 200.

    **Representative mutation:** `POST /rest/v1/profiles`. Expected result: HTTP 200, 201, 204.

    **Mutation input**

    ```json theme={null}
    {
      "display_name": "Maya Chen",
      "email": "maya.chen@example.test",
      "user_id": "10000000-0000-4000-8000-000000000099"
    }
    ```

    **Expected diff:** changes include `database.tables`. Exact match required: no. Hosted promotion must observe every listed path after the provider-native mutation; dynamic provider ids and timestamps are excluded from exact matching.

    **Expected reset:** restores original session seed.

    **Known limits**

    * SQL samples are bounded to the safe state-loader subset; hosted reset behavior requires explicit certification.

    **Start this sample**

    ```bash theme={null}
    archal sample show supabase.vaultline-cart-workflow.v1 --raw > archal-supabase-vaultline-cart-workflow.sql
    archal state validate supabase archal-supabase-vaultline-cart-workflow.sql
    archal session create supabase \
      --state supabase=archal-supabase-vaultline-cart-workflow.sql
    ```

    **Inspect the raw state**

    ```bash theme={null}
    archal sample show supabase.vaultline-cart-workflow.v1 --raw
    ```

    The packaged SQL artifact is `samples/states/supabase/vaultline-cart-workflow/state.sql` and is 6,284 bytes. The CLI verifies SHA-256 `e056f6da1feea484057300d5e3f6163b8d8b3e0f448c9d5c94508890627eb035` before printing it.

    Catalog validation: **Passed**. Hosted availability is determined by Archal's live certification and admission system, not this static page.
  </Accordion>
</AccordionGroup>

## Use custom state

Start from a sample when possible. For custom state, inspect the contract with `archal environment describe supabase`, then validate the file before creating a sandbox:

```bash theme={null}
archal state validate supabase state.sql
```

Loading state replaces the current database contents. The five canonical Supabase samples currently expect reset to restore the original session seed, so verify that behavior before depending on a later SQL load as the baseline. See [Starting state](/sandboxes/starting-state).
