# Deploy Next.js Supabase to Sevalla

> Deploy your MakerKit Next.js Supabase application to Sevalla: Supabase setup, Ingot monorepo build settings, environment variables, migrations, custom domain and webhooks.

*Canonical: https://makerkit.dev/docs/next-supabase-turbo/going-to-production/sevalla*

---

[Sevalla](https://sevalla.com) builds and runs your app from Git, deploys on every push, and handles SSL through Cloudflare. Supabase provides the database, authentication and file storage, so Sevalla only runs the web app.

## Prerequisites

- A Sevalla account
- Your code in a private GitHub, GitLab or Bitbucket repository
- A production Supabase project (Step 1)
- Your billing provider and email provider credentials

## Step 1: Set Up Supabase

Create a production Supabase project and copy its project URL, public key and secret key. Follow [Deploy Supabase to Production](/docs/next-supabase-turbo/going-to-production/supabase) for the full setup.

## Step 2: Create the Application

1. Open **Applications** and create a new application
2. Authorize your Git provider, then select your repository and release branch
3. Choose a location near your users and your Supabase region
4. Choose a resource size. **Hobby (H1) can't serve a custom domain**, so pick a larger size if you plan to launch on your own domain

Creating the application doesn't deploy it. Wait until Step 6: a build without variables ships empty `NEXT_PUBLIC_*` values.

## Step 3: Point Ingot at the Web App

Sevalla's builder, Ingot, detects the pnpm monorepo, but it needs to know which package to deploy:

- Under **Settings → Build strategy**, leave the **Build path** at `.` (the repository root)
- Add `INGOT_APP=apps/web` to the environment variables in Step 4, available during build time

Ingot installs from the root lock file, builds `apps/web` and the workspace packages it depends on, and starts the app from `apps/web`. No repository changes needed.

## Step 4: Add Environment Variables

1. Generate the production variables with `pnpm turbo gen env` (see [Production Environment Variables](/docs/next-supabase-turbo/going-to-production/production-environment-variables)). Keep the generated file out of Git: it contains secrets
2. On the application's **Environment variables** tab, import the file or add the values one by one
3. Leave each variable **available during both build time and runtime** (the default). Next.js inlines `NEXT_PUBLIC_*` values at build time, so a runtime-only public variable reaches the browser as `undefined`

The minimum set:

| Variable | Value |
|----------|-------|
| `INGOT_APP` | `apps/web` (build time) |
| `NEXT_PUBLIC_SITE_URL` | Your production URL, with `https://` and no trailing slash |
| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL |
| `NEXT_PUBLIC_SUPABASE_PUBLIC_KEY` | Supabase public (anon) key |
| `SUPABASE_SECRET_KEY` | Supabase secret (service role) key |
| `SUPABASE_DB_WEBHOOK_SECRET` | Random secret for the database webhook |
| `NEXT_PUBLIC_BILLING_PROVIDER` | Your billing provider, plus its keys |

Add the email provider variables and anything else you configured during development (OAuth, captcha, feature flags, monitoring). For the site URL, use the `*.sevalla.app` domain from the **Domains** tab for now, or your own domain if you'll finish the DNS setup in Step 7.

## Step 5: Configure Supabase Auth and Push Migrations

Set the same URL as the **Site URL** and add it to the **Redirect URLs** in Supabase Authentication settings, as described in [Configure Supabase Authentication](/docs/next-supabase-turbo/going-to-production/authentication).

Then link your local project to the production Supabase project and push the migrations:

```bash
pnpm --filter web supabase link
pnpm --filter web supabase db push
```

Run `db push` again for every new migration, ideally from CI before Sevalla deploys.

## Step 6: Deploy

On the **Overview** tab, click **Deploy now**, check the branch and click **Deploy**. When the deployment reads **Deployed**, check the health endpoint:

```bash
curl https://your-app.sevalla.app/api/healthcheck
```

If the deployment fails, open its details and search the build log for the variable it names. To deploy on every push, go to **Settings → Auto-deploy**, click **Update auto-deploy**, turn it on and save.

## Step 7: Connect a Custom Domain

1. On the **Domains** tab, click **Add custom domain** and enter the domain
2. At your DNS provider, create the two TXT records from the **Verify domain** step (ownership and SSL validation)
3. Create the record from the **Point domain** step: an A record, or a CNAME if your DNS is on Cloudflare
4. Wait for the status to turn **Active**. Sevalla issues and renews the certificate

Then update `NEXT_PUBLIC_SITE_URL`, the Supabase Site URL and the Redirect URLs to the new domain, and deploy again: the old URL is compiled into the current build.

## Step 8: Configure Webhooks

- **Billing provider**: `https://your-domain.com/api/billing/webhook`
- **Supabase database webhook**: `https://your-domain.com/api/db/webhook` (see [Deploy Supabase to Production](/docs/next-supabase-turbo/going-to-production/supabase))

## Shipping Updates and Rolling Back

- **Push to deploy**: with auto-deploy on, commits to your release branch go live automatically
- **Redeploy**: after changing variables, click **Deploy now** on the **Overview** tab
- **Roll back**: on the **Deployments** tab, click **⋯** on an earlier deployment, then **Roll back to this**. Sevalla reuses that build's image without rebuilding. Turn auto-deploy off until the fix lands, or the next push replaces the rollback

## Troubleshooting

| Symptom | Likely cause | Fix |
|---------|--------------|-----|
| Ingot builds the wrong package, or none | `INGOT_APP` missing or not available at build time | Set `INGOT_APP=apps/web` with build time enabled, Build path `.` |
| Build fails with a Zod validation error | A variable is missing or malformed | Run `turbo gen validate-env` locally against your production values |
| Sign-in redirects to the wrong address | Site URL mismatch | `NEXT_PUBLIC_SITE_URL`, Supabase Site URL and Redirect URLs must match exactly |
| **Add custom domain** is disabled | Web process is on Hobby (H1) | Scale to a larger size |

## Related Guides

- [Production Checklist](/docs/next-supabase-turbo/going-to-production/checklist)
- [Production Environment Variables](/docs/next-supabase-turbo/going-to-production/production-environment-variables)
- [Deploy to Cloudways](/docs/next-supabase-turbo/going-to-production/cloudways)
- [Docker](/docs/next-supabase-turbo/going-to-production/docker)
