Migrate from Vercel to VPS: Complete Step-by-Step Guide
Move your Next.js app from Vercel to a self-hosted VPS with zero downtime. This guide covers auditing your existing setup, replacing Vercel-specific features, DNS migration, and post-migration verification.
What you need
Why developers leave Vercel
Vercel is an excellent platform for getting started. But as projects grow, three issues consistently push developers to self-host: unpredictable bandwidth costs that can spike to hundreds of dollars, the Hobby plan's commercial use restriction, and vendor lock-in from Vercel-specific APIs like Edge Config and KV.
A $5/month VPS gives you 20 TB of bandwidth, full SSH access, and the freedom to run any software you need. With DeployWise, the deployment experience is nearly identical to Vercel — push to GitHub, your app updates automatically.
1Audit your Vercel setup
Before migrating, document everything your Vercel project uses. Open your Vercel dashboard and check each of these:
Go to Settings > Environment Variables. Copy every variable — you'll need to set these on your VPS. Pay attention to which are Production vs Preview vs Development.
Check the /api directory. Standard Next.js API routes work identically on a VPS. If you're using Vercel's edge runtime, note which routes use it.
Check middleware.ts at the project root. If you use edge middleware for redirects, rewrites, or authentication, these will need to be adapted to run in Node.js mode.
Look for revalidate settings in your pages. Incremental Static Regeneration works on a self-hosted VPS — Next.js handles it natively.
Check for @vercel/analytics, @vercel/speed-insights, @vercel/og, @vercel/kv, or @vercel/edge-config. These need replacements.
2Choose and set up your VPS
For most Next.js apps migrating from Vercel, we recommend Hetzner CX22 ($4.51/month) or DigitalOcean Basic Droplet ($6/month). Both provide 2 vCPU, 2-4 GB RAM, and more than enough bandwidth.
| Provider | Plan | Price | Specs |
|---|---|---|---|
| Hetzner | CX22 | $4.51/mo | 2 vCPU, 4 GB, 40 GB SSD |
| DigitalOcean | Basic Droplet | $6/mo | 1 vCPU, 2 GB, 50 GB SSD |
| Vultr | Cloud Compute | $6/mo | 1 vCPU, 2 GB, 50 GB SSD |
Choose Ubuntu 22.04 LTS as the OS. After provisioning, make sure you can SSH in: ssh root@your-server-ip
3Install DeployWise on your VPS
Open DeployWise dashboard and sign in with GitHub. Navigate to Servers → Add Server and enter your VPS connection details.
Click Test Connection to verify. DeployWise will automatically install Node.js (via NVM) and PM2 on your server during the first deployment.
4Configure your project
This is the most important step. You need to remove Vercel-specific code and ensure your app runs as a standard Node.js application.
Make sure your Next.js config uses the standalone output mode. This creates a self-contained build that runs without node_modules:
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
}
module.exports = nextConfigUninstall packages that only work on Vercel and replace them:
@vercel/analytics→ Use Plausible, Umami, or PostHog@vercel/speed-insights→ Use web-vitals library directly@vercel/og→ Use @vercel/og alternative or satori@vercel/kv→ Use Redis directly (ioredis)@vercel/edge-config→ Use environment variables or a config fileIf your middleware.ts uses Vercel-specific edge APIs, convert it to use the Node.js runtime. In most cases, adding export const runtime = 'nodejs' to your middleware file is enough. For auth middleware, NextAuth/Auth.js works identically on a VPS.
In DeployWise, go to your project settings and add every environment variable from your Vercel dashboard. DeployWise stores them securely and injects them at build time and runtime, exactly like Vercel does.
5Set up DNS and SSL
To migrate without downtime, set up your VPS first, verify it works, then switch DNS.
Deploy your app and verify it works by accessing your VPS IP directly on the configured port.
Log into your domain registrar (Cloudflare, Namecheap, etc.) and update the A record to point to your VPS IP. If you were using Vercel's nameservers, switch back to your registrar's nameservers first.
DNS changes can take 5 minutes to 48 hours, though most propagate within 30 minutes. Use a DNS checker to monitor.
Once DNS points to your VPS, DeployWise automatically issues a free Let's Encrypt SSL certificate via Certbot. No manual steps required.
6Deploy and verify
In DeployWise, create a new project pointing to your GitHub repo. Set the branch, build command (npm run build), start command (npm start), and click Deploy.
After deployment completes, verify these work correctly:
7Post-migration checklist
Use a free uptime monitor like UptimeRobot or Better Stack to alert you if your app goes down. PM2 automatically restarts crashed processes, but external monitoring catches server-level issues.
Keep your Vercel project intact for at least 2 weeks. If something goes wrong, you can switch DNS back to Vercel in minutes.
Run Lighthouse tests on both your Vercel deployment and VPS deployment. In most cases, a dedicated VPS has lower TTFB than serverless cold starts.
Turn on auto-deploy in DeployWise so that every push to your main branch triggers a new deployment automatically — the same workflow you had on Vercel.
After 2-4 weeks of stable operation, you can safely remove the Vercel project and cancel your Vercel subscription if applicable.
Common gotchas
Vercel gives your build process 8 GB of RAM. A small VPS might only have 1-2 GB. Add a 2 GB swap file: sudo fallocate -l 2G /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile. Or use the standalone output mode to reduce build memory usage.
Next.js image optimization works on a VPS, but it needs sharp installed. Run npm install sharp in your project. DeployWise handles this automatically in most cases.
If your middleware uses Vercel-specific edge APIs (like geolocation headers), these won't be available on a VPS. Replace with IP-based geolocation libraries or move the logic to API routes.
If you used Vercel Cron, set up equivalent cron jobs on your VPS using crontab. For example: */5 * * * * curl -s https://yourdomain.com/api/cron >/dev/null
What about Vercel-specific features?
Replace with Plausible (privacy-focused, $9/mo) or Umami (free, self-hosted). Both are lightweight and don't slow down your site.
Standard Next.js API routes running on your VPS handle most use cases. For global distribution, put Cloudflare in front of your VPS — the free plan includes edge caching.
Use S3-compatible storage like Cloudflare R2 (free for 10 GB), Backblaze B2, or MinIO self-hosted on your VPS.
DeployWise supports branch-based deployments. Push to a preview branch and deploy it alongside your production branch on the same server.
On Vercel Hobby, functions timeout at 10 seconds. On your VPS, there's no timeout — your API routes can run as long as needed.
Ready to migrate?
Sign in with GitHub, add your VPS, and move your Next.js app off Vercel in minutes — for free.
Open DeployWise Dashboard