> ## 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.

# Deployment - Supabase

When deploying your Launchit application, it is recommended to run the migrations on your Supabase instance automatically. This ensures that your database schema is always up-to-date and that you can deploy your application without manual intervention.

## CI/CD

Launchit uses GitHub Actions for continuous integration and deployment. You can find the workflow files in the `.github/workflows` directory. The `supabase-cloud.yaml` / `supabase-selfhosted.yaml` files contains the necessary steps to run the migrations on your Supabase instance.

### Cloud

To deploy your application to Supabase Cloud, you need to set up the following secrets and variables in your repository settings:

#### Secrets

* `SUPABASE_ACCESS_TOKEN`: Your Supabase access token. [Access Tokens](https://supabase.com/dashboard/account/tokens)
* `SUPABASE_DB_PASSWORD_PROD`: Your database password. If you forgot it, you can reset it in the Supabase dashboard (Settings -> Database -> Reset password).
* `SUPABASE_DB_PASSWORD_DEV`: Your database password for development. This is only required if you're hosting a dev database on Supabase Cloud.

#### Variables

* `SUPABASE_PROJECT_ID_PROD`: Your Supabase project ID. You can find it in the URL of your project dashboard.
* `SUPABASE_PROJECT_ID_DEV`: Your Supabase project ID for development. This is only required if you're hosting a dev database on Supabase Cloud.

### Self-hosted

To deploy your application to a self-hosted Supabase instance, you need to set up the following secrets in your repository settings:

#### Secrets

* `SUPABASE_DB_URL_PROD`: Your production database connection URL in the format:

```
postgresql://user:password@host:port/dbname
```

Example:

```
postgresql://postgres:your_password@your-domain.com:5432/postgres
```

* `SUPABASE_DB_URL_DEV`: Your development database connection URL (only required if using a development environment).

#### Components of the Database URL:

* `user`: Database user (typically 'postgres')
* `password`: Your database password
* `host`: Your domain or IP where Supabase is hosted
* `port`: PostgreSQL port (default: 5432)
* `dbname`: Database name (typically 'postgres')

#### Important Notes:

* Make sure your database is accessible from the GitHub Actions runner
* Port 5432 (or your custom port) needs to be open and accessible
* The database user needs sufficient privileges to perform migrations and deployments

<Tip>
  Self hosting tools like [Coolify](https://coolify.io/) or [Dokploy](https://dokploy.com/) can help you deploy your Supabase instance to your VPS.
</Tip>

## Production Settings

#### Auth URL Configuration

In your Supabase project, navigate to the "Authentication" section. Go to the "URL Configuration" tab and set the "Redirect URL" to your production domain.

```
https://<your-production-domain>/auth/callback
```
