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
- In the Cloudways Platform, click Velocity in the left menu, then Get Started (or Add Application for later apps)
- On Choose Your Plan, select a plan and disk size, then click Proceed
- On Server Details, enter a server name, pick a region close to your Supabase project and click Continue
- 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
- Select the repository and click Continue
Step 3: Configure Build Settings
On Review build settings, click Change under Build and output settings:
| Setting | Value |
|---|---|
| Framework Preset | Next.js SSR |
| Branch | main (or your production branch) |
| Node Version | 24.x |
| Root Directory | apps/web |
| Package Manager | pnpm |
| Build Command | pnpm run build |
| Entry File or Start Command | npx next start |
The kit is a monorepo. The Root Directory must be apps/web or the build fails.
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.
- Generate the production variables with
pnpm turbo gen env(see Production Environment Variables). Keep the generated file out of your repository: it contains secrets - Under Environment variables, click Add, then Import .env and select that file
- Mark secrets as Sensitive (the value is hidden permanently after saving)
The minimum set:
| Variable | Value |
|---|---|
NEXT_PUBLIC_SITE_URL | Your production URL, including https:// |
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).
NEXT_PUBLIC_SITE_URL must be set before the first build. If your custom domain is ready, click Add Custom Domain on this screen and use it. Otherwise use a placeholder such as https://example.com and replace it after the first deployment.
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 linkpnpm --filter web supabase db pushRun 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.