How to Deploy Next.js Cheaply Without Vercel
My Next.js app went viral last month. Within hours, I got an email from Vercel: I had hit the edge request limit on my free tier. The traffic spike would have cost me hundreds of dollars on a paid plan.
That’s when I started looking for alternatives. I found several ways to deploy Next.js without Vercel, and they work well.
The Problem with Vercel Pricing
Vercel’s pricing catches many developers off guard:
- Edge request limits on the free tier get hit easily during viral moments
- Paid tiers scale poorly - $20/month Starter plan still has limits
- Serverless function costs accumulate unpredictably
- Bandwidth charges can spike without warning
I needed something more predictable. Here’s what I found.
Solution 1: Standalone Mode + VPS (Recommended)
This is the approach I settled on. It gives you full control and predictable costs.
Step 1: Enable Standalone Mode
First, update your next.config.js:
/** @type {import('next').NextConfig} */const nextConfig = { output: 'standalone',}
module.exports = nextConfigStep 2: Build Your App
Run the build command:
npm run buildThis creates a .next/standalone directory with everything you need to run your app.
Step 3: Copy Static Files
Standalone mode doesn’t include static files by default. Copy them manually:
cp -r public .next/standalone/publiccp -r .next/static .next/standalone/.next/staticStep 4: Deploy to Your VPS
Transfer the standalone folder to your server and run:
node server.jsYour app runs on port 3000 by default.
Step 5: Use PM2 for Process Management
Install PM2 to keep your app running:
npm install -g pm2pm2 start server.js --name my-apppm2 savepm2 startupCost Comparison
| Provider | VPS Cost | Vercel Equivalent |
|---|---|---|
| Hetzner CPX11 | $5/month | $20/month (Starter) |
| Digital Ocean | $6/month | $20/month (Starter) |
| Linode | $5/month | $20/month (Starter) |
A $5 VPS handles thousands of requests per second. Vercel’s Starter tier has edge request limits.
Solution 2: Cloudflare Pages with vinext
Cloudflare Pages has a free tier with generous limits. The catch: Next.js compatibility used to be spotty.
Now there’s vinext, a tool that makes Next.js work better on Cloudflare Pages.
Step 1: Install vinext
npm install vinextStep 2: Configure for Cloudflare
/** @type {import('next').NextConfig} */const nextConfig = { // vinext handles the compatibility layer}
module.exports = nextConfigStep 3: Deploy
Connect your GitHub repo to Cloudflare Pages. The build settings:
- Build command:
npm run build - Output directory:
.next
Cloudflare Pages free tier includes:
- Unlimited bandwidth
- Unlimited requests
- Global CDN
The tradeoff: some Next.js features need workarounds. Edge runtime and serverless functions work differently than on Vercel.
Solution 3: Dokku (Heroku Alternative)
Dokku gives you a Heroku-like experience on your own server. It’s perfect if you like git push deployments.
Step 1: Install Dokku on Your VPS
wget https://dokku.com/install/v0.34.4/bootstrap.shsudo bash bootstrap.shStep 2: Create Your App
dokku apps:create my-nextjs-appStep 3: Add a Dockerfile
Create a Dockerfile in your project root:
FROM node:20-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run build
FROM node:20-alpine AS runnerWORKDIR /appCOPY --from=builder /app/.next/standalone ./COPY --from=builder /app/.next/static ./.next/staticCOPY --from=builder /app/public ./publicEXPOSE 3000CMD ["node", "server.js"]Step 4: Deploy
Add your server as a git remote and push:
git remote add dokku dokku@your-server-ip:my-nextjs-appgit push dokku mainDokku handles SSL, domains, and process management automatically.
Solution 4: Coolify (Self-hosted Vercel)
Coolify is a self-hosted PaaS. Think of it as Vercel you control entirely.
Step 1: Install Coolify
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bashStep 2: Connect Your Repository
Access the Coolify dashboard (usually at port 3000) and:
- Add your GitHub/GitLab repository
- Select “Next.js” as the framework
- Configure environment variables
- Deploy
Coolify gives you:
- Automatic SSL certificates
- Push-to-deploy
- Database management
- Monitoring
- Automatic backups
All on your own servers, with no per-request fees.
Solution 5: Proxy Strategy (Hybrid Approach)
You can keep using Vercel but put Cloudflare in front:
User → Cloudflare (Free Tier) → Vercel (Free/Paid Tier)This works because:
- Cloudflare caches static assets
- Edge requests hit Cloudflare first, reducing Vercel usage
- You still get Vercel’s deployment convenience
Setup Steps
- Add your domain to Cloudflare
- Change your nameservers to Cloudflare’s
- In Cloudflare DNS, point to your Vercel deployment
- Enable Cloudflare’s caching rules
This isn’t as cheap as a pure VPS approach, but it’s a middle ground if you like Vercel’s developer experience.
Which Solution Should You Choose?
| Solution | Best For | Monthly Cost |
|---|---|---|
| Standalone + VPS | Full control, predictable costs | $5-10 |
| Cloudflare Pages | Generous free tier, global CDN | Free |
| Dokku | Git-push deployments, Heroku fans | $5-10 (VPS) |
| Coolify | Vercel-like UX, self-hosted | $5-20 (VPS) |
| Proxy Strategy | Want Vercel DX but less usage | Free + Vercel tier |
I picked the standalone mode + VPS approach. It gives me:
- Predictable $5/month cost
- Full server control
- No surprise bills
- Easy scaling (just upgrade the VPS)
Summary
In this post, I showed you five ways to deploy Next.js without relying on Vercel. The standalone mode with a VPS is my top pick for predictable costs and full control. Cloudflare Pages with vinext offers a generous free tier if you can work around compatibility issues. Dokku and Coolify give you Heroku and Vercel-like experiences on your own servers.
If you’re hitting Vercel’s limits or worried about surprise bills, try one of these alternatives. Your wallet will thank you.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments