--Hours--Mins--Secs
Christmas & New Year deal.Up to 70% off lifetime control panel access + xCloud managed server plansGrab deal NOW

How to Migrate a Next.js App from Vercel to xCloud

Updated December 5, 2026 · 9 min read

Summarize with:
Share:

You can move a Next.js app from Vercel to your own server with xCloud without changing its code. Deploy the same Git repository with Deploy via Git, paste your Vercel environment variables, replace any Vercel cron jobs, test on a free staging domain, then point your domain at the server and remove the Vercel project. The app runs with next start under PM2 behind Nginx, so server-rendered pages, API routes, middleware and image optimization keep working.

This guide is for one Next.js app deployed from GitHub, GitLab or Bitbucket. For the full first-deploy walkthrough, see Deploy a Next.js app on xCloud. For what Next.js hosting on xCloud includes, see Next.js hosting.

What changes when you leave Vercel

Read this before you start, so nothing surprises you after the move. The facts about Next.js come from the Next.js self-hosting guide and the facts about Vercel from Vercel’s docs, both checked on 5 December 2026.

On Vercel On xCloud
Middleware (proxy) Works with next start, no setup needed.
Image Optimization (next/image) Works with next start; images are optimized on your server when they are requested.
ISR and the data cache Stored on the server’s disk by default. One server means one shared cache.
Cron jobs in vercel.json Not read. Add a site cron job in xCloud instead (Step 6).
Preview deployment for every pull request Not available. Deploy a branch to a second site if you need a test copy.
Global edge network and serverless functions Not available. Your app runs on one server in one region, and you choose its size.
Environment variables in project settings One .env file in the site’s folder.

If your app uses output: 'export' in next.config.*, xCloud deploys it as a static site and no Node process runs. Everything else in this guide still applies.

Before you start

  • A server connected to xCloud with Nginx, and Node.js installed in a version your Next.js release supports. See How to change the Node.js version.
  • Access to the Git repository the Vercel project deploys from.
  • Access to your Vercel project’s settings and to the DNS records of your domain.

Step 1: Export your environment variables from Vercel

Open your project in Vercel and copy your Production variables from the project’s environment variable settings into a local file, one KEY=value per line.

Leave out any lines that start with VERCEL_: they describe Vercel’s own deployment and mean nothing on your server. Keep your own keys, database URLs and every NEXT_PUBLIC_ value.

Expected result: A file with one KEY=value per line that holds only your app’s own settings. Keep it out of Git.

Step 2: Lower the DNS TTL

Lower the TTL of your domain’s DNS records to 300 seconds (five minutes) now, at least one old TTL before you switch. When you change the records in Step 7, visitors then reach the new server within minutes.

Step 3: Deploy the repository with Deploy via Git

In xCloud, open your server, click Add New Site and choose Deploy via Git. Paste the repository URL or pick it from your connected Git account. xCloud reads package.json and next.config.* and fills in the form.

Check what it found: the Native app button shows the Next.js tag, and App Type is set to Node.js. Keep the free staging domain for now, and set the Branch your Vercel production deployment uses (often main).

The Native app button with the Next.js tag after pasting the repository in Deploy via Git

If the type is wrong, select Node.js yourself.

Step 4: Check Build & serving

In Build & serving, check the three values xCloud filled in:

  • Serving mode: SSR (Node process) for a normal Next.js app; Static build with web root out for output: 'export'.
  • Start command: npm run start, which runs next start.
  • Port: the port the app listens on, for example 3000. next start reads it from PORT, so keep -p out of your start script.

The Build & serving section with SSR (Node process), the start command npm run start and port 3000

If you see Release mode (zero-downtime deploys) below it, switch it on to deploy without downtime from the first release. It is in beta and only shows if it is turned on for your account. See Zero-downtime deployments for Node.js apps.

Step 5: Paste your variables and deploy

Open Advance. Check the Node.js Version; the line under it names the package manager xCloud found in the repository. Then paste the file from Step 1 into Environment file (.env).

The Environment file (.env) field in the Advance section, filled with the app’s variables

Set NEXT_PUBLIC_SITE_URL, auth callback URLs and similar values to the staging domain for the first test; you change them to your domain in Step 7. Next.js writes NEXT_PUBLIC_ values into the browser code at build time, so a change to one needs a new deploy.

The Build & deploy script below already holds the install and build commands for your package manager. Click Deploy.

Expected result: The deployment finishes and the site opens on its staging domain. If it fails, open the site’s Monitoring → Logs and select PM2 Log, or see Troubleshooting Git deployments.

Step 6: Replace Vercel cron jobs

If your vercel.json has a crons list, add each job in xCloud. Vercel calls the job’s path with an HTTP GET request to your production URL, and its schedule is always in UTC. Open the site, go to Tools → Cron Jobs, click Add Cron Job, and use a command that calls the same route:

curl -fsS https://example.com/api/cron/daily

Use the same schedule, converted from UTC to your server’s time zone if they differ. If the route checks a secret header, send it with -H. See How to add a custom cron job in xCloud.

Step 7: Test, then move your domain

Test the staging site before you switch: open a server-rendered page, an API route such as /api/health, a page with next/image images, a login if you have one, and any form that writes data.

When everything works:

  1. Move the site to your domain with How to go live from a staging domain.
  2. At your DNS provider, replace the records that point at Vercel with records that point at your xCloud server’s IP. If your DNS is on Cloudflare, see Using xCloud with Cloudflare for DNS management.
  3. Turn on HTTPS with Enable HTTPS and configure SSL certificates.
  4. Change NEXT_PUBLIC_SITE_URL and auth callback URLs to your domain in the site’s .env, then deploy again.

Expected result: Your domain loads the app from xCloud with a valid certificate, and dig +short example.com returns your xCloud server’s IP.

Step 8: Remove the Vercel project

Wait until the old TTL has passed and the xCloud site has served real traffic for a few days. Then, in Vercel, open the project, select Settings in the sidebar, and on the General page click Delete in the Delete Project section at the bottom. Deleting removes its deployments, domains, environment variables and settings, and can’t be undone, so keep the Step 1 file. To keep the project as a fallback for a while, use the Pause Project button in the section above it instead.

If something goes wrong

Symptom Cause and fix
Build fails with a Node.js version error The server’s Node.js is older than your Next.js release needs. Update Node.js, then deploy again.
next build runs out of memory Vercel builds on its own machines; on xCloud the build runs on your server. Use a server with more RAM, then deploy again.
Site returns 502 The app isn’t answering on the Port. Check the PM2 Log and remove any fixed -p port from the start script.
Logins redirect to the staging or Vercel URL An auth callback or site URL variable still has the old value. Update it in .env and deploy again.
A scheduled task stopped running It was a Vercel cron job. Add it as a site cron job (Step 6).

To go back while DNS is still changing, point the records at Vercel again; nothing on Vercel changes until you delete the project.

Frequently asked questions

Can xCloud import a Vercel project automatically?

No. There is no Vercel importer. You deploy the same Git repository with Deploy via Git, paste your Vercel environment variables into the .env field, and move cron jobs and the domain yourself. Most Next.js apps need no code change.

Do Next.js middleware, image optimization and ISR work after I leave Vercel?

Yes, with next start. The Next.js self-hosting guide says middleware (proxy) and image optimization work with no extra setup, and the ISR cache is stored on the server’s disk. On xCloud your app runs with next start under PM2, so these features keep working on one server.

What do I lose when I move from Vercel to xCloud?

Automatic preview deployments for every pull request, Vercel’s global edge network and serverless functions that scale by themselves. On xCloud your app runs on one server in one region, and you choose the server size.

How do I replace the cron jobs in vercel.json?

Add a site cron job in xCloud under Tools, Cron Jobs. Vercel calls your route with an HTTP GET request on a UTC schedule, so the xCloud cron job can call the same URL with curl on the same schedule.

If you run into any issues moving your app from Vercel, feel free to reach out to our support team.