Deploy Next.js Supabase to Cloudways Velocity

Deploy your MakerKit Next.js Supabase application to Cloudways Velocity: Supabase setup, build settings, environment variables, migrations, custom domain and webhooks.

Cloudways Velocity runs your Next.js app as a persistent Node.js process (NGINX and PM2), with Git-based deployments, environment variables and build logs. Supabase provides the database, authentication and file storage, so Velocity only runs the web app.

Prerequisites

  • A Cloudways account
  • Your code pushed to GitHub, GitLab or Bitbucket
  • 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 for the full setup.

Step 2: Create the Velocity Application

  1. In the Cloudways Platform, click Velocity in the left menu, then Get Started (or Add Application for later apps)
  2. On Choose Your Plan, select a plan and disk size, then click Proceed
  3. On Server Details, enter a server name, pick a region close to your Supabase project and click Continue
  4. On Select Repository, choose your Git provider and click Connect. On GitHub, install the Cloudways Deploy app; Only select repositories with your repo is enough
  5. Select the repository and click Continue

Step 3: Configure Build Settings

On Review build settings, click Change under Build and output settings:

SettingValue
Framework PresetNext.js SSR
Branchmain (or your production branch)
Node Version24.x
Root Directoryapps/web
Package Managerpnpm
Build Commandpnpm run build
Entry File or Start Commandnpx next start

Step 4: Add Environment Variables

Add the variables on the same Review build settings screen, before clicking Deploy Now. Velocity applies them at build time and runtime, and Next.js inlines NEXT_PUBLIC_* values into the bundle during the build: without them, the first build ships empty public values.

  1. Generate the production variables with pnpm turbo gen env (see Production Environment Variables). Keep the generated file out of your repository: it contains secrets
  2. Under Environment variables, click Add, then Import .env and select that file
  3. Mark secrets as Sensitive (the value is hidden permanently after saving)

The minimum set:

VariableValue
NEXT_PUBLIC_SITE_URLYour production URL, including https://
NEXT_PUBLIC_SUPABASE_URLSupabase project URL
NEXT_PUBLIC_SUPABASE_PUBLIC_KEYSupabase public (anon) key
SUPABASE_SECRET_KEYSupabase secret (service role) key
SUPABASE_DB_WEBHOOK_SECRETRandom secret for the database webhook
NEXT_PUBLIC_BILLING_PROVIDERYour billing provider, plus its keys

Add the email provider variables and anything else you configured during development (OAuth, captcha, feature flags, monitoring).

Click Deploy Now. The first deployment can take several minutes. If it fails, open the build's details and read the logs: the usual cause is a missing or malformed variable.

Step 5: Set the Real Site URL

NEXT_PUBLIC_SITE_URL must exactly match the URL users visit, including https://. It builds links in emails, auth callbacks and billing redirects.

If you used a placeholder, copy the domain from Overview → Application Domain (https://nodejs-xxxx.cloudwaysnodeapps.com), update NEXT_PUBLIC_SITE_URL, and click Save & Redeploy.

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

Step 6: Push Database Migrations

Link your local project to the production Supabase project and push the migrations from your machine:

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

Run db push again whenever you ship new migrations, ideally from CI before the deployment.

Step 7: Connect a Custom Domain

Every app gets a temporary *.cloudwaysnodeapps.com domain. To use your own, add it under the application's domain settings and follow the DNS instructions Cloudways shows. SSL is issued automatically. Then update NEXT_PUBLIC_SITE_URL, the Supabase Site URL and Redirect URLs to the custom domain, and redeploy.

Step 8: Configure Webhooks

Point the webhooks to your production domain:

  • Billing provider: https://your-domain.com/api/billing/webhook
  • Supabase database webhook: https://your-domain.com/api/db/webhook (see Deploy Supabase to Production)

Deploying, Rolling Back and Logs

  • Application → Deployment Management → Deployments: toggle Auto-deployment to deploy on every push, or click Redeploy. Each row has View Details (build logs) and Redeploy; redeploying an earlier commit is how you roll back
  • Application → Monitoring → Logs: access, error and runtime (PM2 stdout/stderr) logs, in UTC
  • Application → Overview → PM2 Service: restart the app process
  • Health check: https://your-domain.com/api/healthcheck

Troubleshooting

The build fails with a Zod validation error. A variable is missing or malformed. Run turbo gen validate-env locally against your production values to find it.

The site URL is invalid. Use a fully qualified URL with the protocol: https://example.com, not example.com.

Sign-in redirects to the wrong URL. The Supabase Site URL, Redirect URLs and NEXT_PUBLIC_SITE_URL must match exactly, including https:// and no trailing slash.