# Supabase

Supabase is the backend of your app: database, sign-in and server functions. The factory creates one Supabase project per app. **Needed for both presets**; the Prototype keeps the backend.

**Time:** about 5 minutes. **Needs:** a Supabase account and organization. Billing on file is needed if you want more than two active projects.

## Steps

1. Sign up at <https://supabase.com> and create an organization.
2. While signed in to the account that owns that organization, open <https://supabase.com/dashboard/account/tokens>.
3. Click **Generate new token**, name it `starwisp`, and pick the longest expiry offered.
4. Copy the token. It starts with `sbp_` and is shown once.

**Least privilege:** this is a personal access token, so it can do whatever your account can in that organization. Use an account that only owns the organization Starwisp uses. Set an expiry and note the date.

## Where it goes

Console → **Settings → Vault** → card **Supabase access token** → field **Personal access token** (secret `SUPABASE_ACCESS_TOKEN`). Click **Test now**.

If you have more than one Supabase organization you can set the repository variables `SUPABASE_ORG_SLUG` and `SUPABASE_REGION` on `<org>/factory` (Settings → Secrets and variables → Actions → Variables). Both are optional.

**You should now see** a passing test on the card.

## What it gates

The **backend** and **launch** stages: creating the project, running migrations, deploying server functions and setting their secrets.

## What it costs

Estimates from Supabase's public pricing, to be re-checked: Free is $0 for up to 2 active projects, and idle free projects pause after one week. Pro starts at $25 a month and includes a credit that covers one small project; each extra project is about $10 a month. The factory books an estimated $10 against your budget for each project it creates.

## Slow prerequisites

None to start. If you build more than two apps you need Pro, and the factory will not silently create a third free project.

## Common problems

A paused free project stops answering until restored in the Supabase dashboard (restorable for 90 days, per Supabase's changelog; unverified).
