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

# Supabase Schemas

> Per-tenant PostgreSQL schema manager for Supabase — run 80+ isolated tenants in a single Supabase instance.

`supabase-schemas` lets you run dozens of isolated app schemas inside a single Supabase instance. Each tenant gets its own `app_<id>` PostgreSQL schema with migration tracking — without paying for multiple Supabase projects.

<CardGroup cols={2}>
  <Card title="GitHub" icon="github" href="https://github.com/nometria/supabase-schemas">
    nometria/supabase-schemas
  </Card>

  <Card title="PyPI" icon="python" href="https://pypi.org/project/supabase-schemas/">
    supabase-schemas on PyPI
  </Card>
</CardGroup>

## Install

```bash theme={null}
pip install supabase-schemas
```

## Setup

```bash theme={null}
export DATABASE_URL=postgresql://postgres.your-ref:password@aws-0-us-east-1.pooler.supabase.com:5432/postgres
```

## Usage

```bash theme={null}
# Create a new tenant schema
supabase-schemas create acme-corp

# List all tenant schemas
supabase-schemas list

# Run migrations for a specific tenant
supabase-schemas migrate acme-corp --migrations-dir ./migrations

# Run migrations for all tenants
supabase-schemas migrate-all --migrations-dir ./migrations

# Drop a tenant schema
supabase-schemas drop acme-corp
```

## How it works

Each tenant gets an isolated PostgreSQL schema:

```sql theme={null}
-- Created automatically by: supabase-schemas create acme-corp
CREATE SCHEMA app_acme_corp;

-- Each schema gets its own tables, functions, and policies
-- Row-level security is scoped per schema
-- auth.users view is wired automatically
```

Migration tracking is per-tenant:

```sql theme={null}
-- app_acme_corp.schema_migrations
id | name                     | applied_at
1  | 001_create_users.sql     | 2025-01-15 10:00:00
2  | 002_add_settings.sql     | 2025-01-20 14:30:00
```

## Use cases

| Scenario                       | How                               |
| ------------------------------ | --------------------------------- |
| SaaS with isolated tenant data | One schema per customer           |
| White-label apps               | One schema per white-label client |
| Development environments       | One schema per developer          |
| Feature branches               | One schema per branch             |

## Cost comparison

| Approach                          | Monthly cost (10 tenants)  |
| --------------------------------- | -------------------------- |
| 10 separate Supabase projects     | \~\$250/mo (Pro plan × 10) |
| supabase-schemas (single project) | \~\$25/mo (one Pro plan)   |

<Note>Schema isolation provides strong logical separation but not the same security boundary as separate Supabase projects. For compliance-sensitive workloads, evaluate whether schema-level isolation meets your requirements.</Note>
