Skip to content

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.

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:

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
}
module.exports = nextConfig

Step 2: Build Your App

Run the build command:

Terminal
npm run build

This 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:

Terminal
cp -r public .next/standalone/public
cp -r .next/static .next/standalone/.next/static

Step 4: Deploy to Your VPS

Transfer the standalone folder to your server and run:

Terminal
node server.js

Your app runs on port 3000 by default.

Step 5: Use PM2 for Process Management

Install PM2 to keep your app running:

Terminal
npm install -g pm2
pm2 start server.js --name my-app
pm2 save
pm2 startup

Cost Comparison

ProviderVPS CostVercel 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

Terminal
npm install vinext

Step 2: Configure for Cloudflare

next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
// vinext handles the compatibility layer
}
module.exports = nextConfig

Step 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

Terminal
wget https://dokku.com/install/v0.34.4/bootstrap.sh
sudo bash bootstrap.sh

Step 2: Create Your App

Terminal
dokku apps:create my-nextjs-app

Step 3: Add a Dockerfile

Create a Dockerfile in your project root:

Dockerfile
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]

Step 4: Deploy

Add your server as a git remote and push:

Terminal
git remote add dokku dokku@your-server-ip:my-nextjs-app
git push dokku main

Dokku 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

Terminal
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

Step 2: Connect Your Repository

Access the Coolify dashboard (usually at port 3000) and:

  1. Add your GitHub/GitLab repository
  2. Select “Next.js” as the framework
  3. Configure environment variables
  4. 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:

Traffic Flow
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

  1. Add your domain to Cloudflare
  2. Change your nameservers to Cloudflare’s
  3. In Cloudflare DNS, point to your Vercel deployment
  4. 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?

SolutionBest ForMonthly Cost
Standalone + VPSFull control, predictable costs$5-10
Cloudflare PagesGenerous free tier, global CDNFree
DokkuGit-push deployments, Heroku fans$5-10 (VPS)
CoolifyVercel-like UX, self-hosted$5-20 (VPS)
Proxy StrategyWant Vercel DX but less usageFree + 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