Infrastructure and SEO

Self-hosting Next.js with Docker vs Vercel: when each wins

Self-hosting Next.js on a managed VPS can cut a $600 Vercel bill to about $90. Here is what you trade away, and the month the swap is worth it.

June 25, 20265 min read
a close up of a server in a server room

Self-hosting Next.js means running your own production build with output: 'standalone' inside a Docker container, on a server you control, instead of pushing to Git and letting Vercel handle the runtime. The application code is identical either way. The decision is about who carries the operational load, and what that load buys you in cost, control, and constraints.

This matters most when a SaaS crosses from side-project traffic into real usage. On a small app, Vercel's free tier is hard to argue with. On an app serving hundreds of thousands of visitors a month, the bill and the platform limits start to shape architecture decisions. Below is the comparison we use when a client asks where to deploy. If you are still choosing a runtime at the function level, that is a separate decision we cover in edge runtime vs node runtime.

The short version

Pick Vercel when the team is small, traffic is unpredictable, and engineering time is worth more than the hosting bill. Pick self-hosted Docker when traffic is steady and high, when you need long-running work that serverless functions cut off, or when data residency and cost control outweigh the convenience. Most products start on the first and move to the second only when the numbers force it.

Vercel vs self-hosted Docker: the honest comparison

AxisVercelSelf-hosted Docker
Setupgit push, zero configDockerfile, VPS, reverse proxy, CI/CD you own
Cost at ~500K visits/month~$600/month (reported)~$90/month on a managed VPS (reported)
Long-running workfunctions cap at 300s on Prono execution limit
Global edgebuilt inadd a CDN yourself
Preview deploysbuilt inCoolify or your pipeline
Image optimizationautomaticinstall sharp in the runner stage
ISR across instancesautomaticcustom cache handler (Redis)
Uptimemanaged, SLA on Enterpriseyours, no SLA
Best fitsmall teams, spiky trafficsteady high traffic, cost or data limits

Where self-hosting wins

Cost at scale

A workload of 500,000 monthly visitors that runs around $600 on Vercel can run near $90 on a managed VPS with Coolify, roughly an 85% cut (MassiveGRID). The saving comes from flat server pricing: no per-seat fees, and no bandwidth overage at $0.15 per gigabyte past the included terabyte (Vercel pricing).

No execution ceiling

Vercel functions on the Pro plan stop at 300 seconds (Vercel function limits). A self-hosted Node process can run a report, a PDF render, or a long AI model call for as long as the work needs.

Data next to compute

You can run Postgres in the same Docker network as the app and drop database latency to near zero. That helps with regulated data that has to stay in a specific region, and with chatty queries that pay a round-trip tax on a hosted database.

No platform lock

The standalone output is plain Node. It runs on any VPS, any cloud, or Kubernetes. Moving providers is a redeploy, not a rewrite.

Where Vercel wins

Zero operations

git push deploys, automatic SSL, no server to patch. For a solo founder or a three-person team, the hours saved are worth more than the bill.

The edge network and image pipeline just work

Global CDN, image optimization, and ISR run with no configuration. On self-hosted, each of these is a task you own and a thing that can break.

Preview deployments per pull request

Built in. A reviewer opens a live URL for every branch without thinking about it.

It scales without you watching

Traffic spikes are the platform's problem, not a 2am page for whoever is on call.

The caveats nobody mentions until production

sharp

The standalone trace often leaves out sharp, the native module Next.js uses for image optimization. You install it explicitly in the Docker runner stage, or images break on the first deploy (Next.js self-hosting guide).

The ISR cache

By default the cache is the local filesystem of a single instance. Run two instances behind a load balancer and they fall out of sync. Multi-instance ISR needs a custom cache handler backed by shared storage, usually Redis (Next.js self-hosting guide).

Static assets

The standalone server serves static files but is not built for it. Under load, serving assets from Node steals CPU that should go to rendering. Put a CDN or Nginx in front.

Uptime

No managed SLA. If the VPS goes down, the app goes down. Plan monitoring, backups, and a rollback path before launch, not after the first outage.

What we use and why

We default new SaaS builds to Vercel. Early on, traffic is unknown and the team is small, so paying for zero operations is the right trade. We run our own marketing site the same way. When a product reaches steady, predictable traffic, or needs long-running jobs, or carries data with residency rules, we move it to a self-hosted Docker build behind a reverse proxy, with Redis for the ISR cache and a CDN in front of static assets. The trigger is never ideology. It is the month the Vercel bill, or a platform limit, costs more than the operational time to run our own. Teams that self-host report roughly five hours to wire up the pipeline and 10 to 20 hours a year to maintain it (Autonoma). Price that time in before you decide.

Sources

Photo by Tyler on Unsplash

Frequently asked questions

How much does self-hosting Next.js actually save versus Vercel?
It depends on traffic. Below the free tier, Vercel is cheaper than any VPS because it is free. The gap opens at scale. Reported workloads of around 500,000 monthly visitors run near $90 on a managed VPS against roughly $600 on Vercel, an 85% cut. The saving is flat server pricing with no per-seat fees and no bandwidth overage. Subtract the engineering time you spend running it before you call it a win.
Do I lose ISR and image optimization if I leave Vercel?
No, but you configure them yourself. Incremental Static Regeneration works out of the box on a single instance with persistent disk. Across multiple instances you need a custom cache handler backed by Redis or similar. Image optimization works once you install the sharp module in the Docker runner stage; the standalone trace often leaves it out. Both are solvable in an afternoon, but neither is automatic the way it is on Vercel.
Is Coolify enough, or do I need Kubernetes?
For most SaaS, Coolify or a similar PaaS layer on a single VPS is enough. It gives you git-push deploys, automatic SSL, and preview environments without writing Kubernetes manifests. Reach for Kubernetes when you genuinely run many services, need horizontal autoscaling across nodes, or have an ops team to maintain it. For one app and a small team, Kubernetes is usually more operational weight than the workload justifies.
When is it a mistake to leave Vercel?
When the team is small and traffic is unpredictable. Self-hosting trades a predictable bill for operational responsibility: uptime, security patches, backups, and CI/CD are now yours. If your Vercel bill is under a few hundred dollars a month and nobody on the team wants to own a server at 2am, the move costs more in attention than it saves in cash. Leave when the numbers, not the principle, push you.

Studio

Start a project.

One partner for the digital product you need to build. Faster delivery, modern tech, lower costs. One team, one invoice.