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

# Supabase

## Required Environment Variables

After installation, you need to set up your environment variables. Copy the `.env.example` file to `.env` and configure the following required variables:

### Base Configuration

```bash web/.env theme={null}
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
```

Set this to your local development URL. In production, update it to your deployed domain.

### Supabase Configuration

```bash web/.env theme={null}
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
```

### URL Configuration

#### Live

Set your `Site URL` to your deployed auth callback URL. `https://www.yourdomain.com/auth/callback`

#### Testing

Make sure to add your `Redirect Urls` to `URL Configuration` in `Authentication` in Supabase.

Localhost would be `http://localhost:3000/**`

#### Cloud

Create a new [Supabase](https://supabase.com/) project and copy these values from your project dashboard. They can also be obtained by going to "Project settings" -> "API".

<Info>
  You probably want to set your own SMTP server and set up your credentials in Supabase to avoid rate limiting. You can do this by going to "Project settings" -> "Authentication" -> "SMTP Settings".
  In this case, make sure you set spf and dkim in your DNS records. Otherwise, your emails will not be delivered to some providers like gmail.
</Info>

<Warning>
  Don't forget to save your database password in a secure location. Otherwise, you have to reset it.
</Warning>

#### Selfhosted

For local development, go to `supabase/config.toml` and set your project name. Start your database by running

```bash theme={null}
cd supabase
supabase start
```

You will then get your keys displayed in the terminal. Copy them to your `.env` file. Of course, you can also use your self-hosted Supabase instance.

## Migration

Before you can start using Supabase, you need to run the migrations.

For local development, you can use the following commands (should be run automatically when starting the project):

```bash theme={null}
cd supabase
npx supabase migration up
```

When using a hosted Supabase instance, [link your project](https://supabase.com/docs/guides/deployment/database-migrations#deploy-your-project) or paste the migrations manually.

For production, you should use a CI. See [Deployment - Supabase](/deployment/supabase) for more information.
