Insights / October 24, 2026

Vercel alternatives: how we moved a Next.js API off Vercel

The main Vercel alternatives for a Next.js app are your own server running next start behind nginx, containers on a managed platform, and Cloudflare Workers through an adapter. You don’t have to move everything at once. For a real-time trading platform, we moved the public API’s reads, about 94% of its requests, to our own server and cut the Vercel bill by about 90%. The API stayed identical, so clients only had to change a hostname.

Option How it bills Best when
Your own server or VPS A flat monthly price per machine Traffic is steady and someone can run servers
Containers on a managed platform Per instance or per resource, depending on the provider You want a managed runtime without per-request pricing
Cloudflare Workers Per request and CPU time Your app runs on Cloudflare’s Next.js tooling

Why the Vercel bill grew

After launch, automated clients started polling the platform’s public API more than 20 million times a day. Vercel bills per request, and each API call was billed several times over: a CDN request, a rate-limit check that made its own request, a middleware invocation and the route itself. The bill went from about $25–40 a day to about $300. Our Vercel pricing breakdown covers that mechanism in detail.

We fixed the cheap things in place first, such as taking the API routes out of the middleware matcher. Those helped, but at 20 million requests a day, per-request pricing stays expensive however lean each request is.

What moved and what stayed

Every read endpoint, about 94% of API requests, moved to one dedicated server. Writes stay on Vercel for now, right next to the database, for reasons covered below. So do the website, webhooks, background jobs and crons.

One Vercel project routing rule meant clients didn’t need to change anything. It rewrites matching paths on the old hostnames to the new API hostname, so the client keeps calling the same URL and Vercel forwards it. Routing rules publish without a deploy, which gave us instant rollback: disable the rule and traffic returns to Vercel within seconds.

Two things to know about this setup:

  • Routing rules can’t match on HTTP method. They match host, path, headers, cookies and query, so a forwarding rule can’t split a path that serves both reads and writes, like /orders. While a client still calls the old address, reads on those mixed paths stay on Vercel. Once it calls the new hostname, every read goes straight to the server.
  • Forwarding isn’t free. Each forwarded request is still a billed Vercel request, so forwarding is a bridge, not the destination. Clients that switch to the new hostname skip Vercel completely, and once they have, the old address can be retired.

The server

One Hetzner cloud server with 16 dedicated vCPUs in US West. A month of it costs about what Vercel had been charging for a single day. Check Hetzner’s cloud pricing for current numbers.

  • Twelve Node processes, one nginx. Each worker is next start on its own port, run by systemd. Measured CPU per request at peak called for eight workers; we run twelve for headroom.
  • Sticky routing by API key. nginx hashes each request by its API key, so a client always reaches the same worker and that worker’s in-memory caches stay warm. Without it, twelve separate caches missed the API-key lookup four times as often as Vercel’s shared cache. With it, misses dropped below Vercel’s.
  • Cloudflare in front. The API hostname is proxied through Cloudflare, and the server’s firewall accepts HTTPS only from Cloudflare’s IP ranges, so nothing reaches it directly. Use a Cloudflare origin certificate with strict SSL, read the real client IP from CF-Connecting-IP, and turn off Browser Integrity Check for the API hostname, since it can block clients that don’t look like browsers. Below Enterprise, Cloudflare stops waiting after about two minutes (error 524), far short of a Vercel Pro function’s 800 seconds, so check your slowest routes before moving them.
  • Deploys from CI, after migrations. A deploy job runs after the database migration job. It type-checks the commit in CI, copies the source over, builds on the server, then restarts workers one at a time, each taken out of nginx first and probed before the next. Any failure puts every worker back on the previous release. Migrations must work with the release before them, the same rule Vercel’s rolling deploys need.

Three things that bit us

Next’s disk cache grew without limit

Self-hosted, Next keeps its data cache in memory and on disk by default. Our API caches market data in one- and two-second windows, so on disk every window becomes a new file under .next/cache/fetch-cache, and nothing ever deletes them. One line in next.config fixes it: experimental.isrFlushToDisk: false keeps the cache in memory only. Our health check counts the files in that folder. It should be zero.

Database latency: why writes are the last piece

Vercel runs the API about 2 ms from the database. The new server is about 24 ms away. That’s fine for reads and costly for writes: each order makes several database round trips in a row, and the extra 22 ms adds up on every one. In testing, sending writes to the new server took the batch order median from 1.0 to 3.75 seconds, so writes never moved there. They stay on Vercel until they get a server in the database’s own data center.

For reads, the server-side median on database-heavy routes is about 1.75 times Vercel’s, but clients complete the same number of requests as before. They’re held back by their rate limits, not by latency, and responses still meet the API’s published one- and two-second freshness promise.

Environment settings must fail loudly

vercel env pull returns values Vercel stores as Sensitive as empty strings, so those have to be filled in by hand. The bigger risk is a setting added on Vercel later and never copied over: code that falls back to a default when a setting is missing keeps running, just wrongly. So settings the API depends on are required and fail loudly when unset. A manifest lists every setting the API code can read, marked required, optional or excluded, and a test fails when the code reads one the manifest doesn’t list. The deploy script checks the server’s environment against the manifest before building and again before switching releases. It also keeps secrets off the server: no payment, SMS or sign-in keys.

What we deliberately didn’t build

The first plan had a shared Redis cache, blue/green deploys, a standalone build, a staging API server and a synthetic load-test gate. We cut them all. Cache hit rates in production were about 5% for order books and under 1% for trades, so a shared cache would buy little. Rolling restarts with nginx draining give zero errors. Each extra part needed a measured problem to justify it, and none had one.

The result

Daily spend Before After Change
Vercel ~$300 ~$30 −90%
All infrastructure, including the realtime move ~$1,190 ~$110 −91%

The Vercel bill fell about 90%. With live updates on our own server too, total infrastructure spend fell by the same margin, new servers included.

What’s next

Writes are the last piece on Vercel. They need a server in the same data center as the database, and that move takes the Vercel bill under $10 a day, leaving only the website.

The best final setup goes one step further: run Postgres yourself, in the same data center as the API and realtime servers. Database round trips stay inside one building, writes can leave Vercel without slowing down, and the remaining Supabase bill goes with them. For an app this busy, owning the whole stack in one place is both the fastest option and the cheapest.

When to move off Vercel, and when to fix the bill in place

Fix it in place first if the cost comes from configuration: middleware running on every API call, an SDK making extra requests, responses that could be cached, or bots you could block. Those are small code changes.

Moving is worth it when the traffic is high-volume, steady and machine-generated, the work is plain request and response, and someone on the team can run a server. If traffic is spiky or nobody wants to own servers, Vercel’s model is usually still the better deal.

The main alternatives:

  • Your own server or VPS. next start behind nginx, as above. The cheapest per request by far, but patching, deploys and capacity are yours.
  • Containers on a managed platform. Next runs in a Docker image on platforms like Render, Fly.io or Google Cloud Run. Billing models differ, so price your traffic on each.
  • Cloudflare Workers. Runs Next through an adapter; Cloudflare currently recommends its beta vinext, with OpenNext as a fallback. Check that the Next features you use are supported.

How to check your own app

  1. Open Vercel’s usage page and find the biggest line before changing anything.
  2. Find which routes drive it, and whether that traffic comes from people or machines.
  3. Check your middleware matcher. If it runs on API routes, every API call pays for an extra invocation.
  4. List the routes that write, and count their database round trips. Those suffer most when you move away from the database.
  5. If you self-host Next, set experimental.isrFlushToDisk: false or add a bounded cache handler, then watch .next/cache/fetch-cache.
  6. List every environment variable the moved code reads, and make missing ones fail the deploy.

If your Vercel bill is growing faster than your users, a vibe coding rescue starts by finding which requests you’re paying for, then moving or cutting them.

LET’S TALK.

Book a free 30-minute call with Virgil

Pick a time that suits you. You’ll get a straight answer on what you need, what it should cost and the fastest path to launch.

Loading available times…

Open the calendar in a new tab

Send us your project

Virgil replies personally within one business day.

Book a free strategy call