Self-host a Next.js app (leave Vercel)
The short version: Next.js is just a Node app - it does not need Vercel. Build it with next build (use output: "standalone" for a lean, self-contained bundle), run the server behind a reverse proxy that terminates SSL, keep it alive with systemd, and ship it with your CI pipeline. You trade the managed edge, ISR, and image conveniences for control, predictable cost, and no lock-in - and you reconfigure the few things the platform did for you.
What you actually need
Node + a standalone build
next build with output: "standalone" emits a self-contained server you run with node server.js.
Reverse proxy + SSL
nginx or Caddy in front terminates HTTPS and forwards to the Next.js port - Caddy gets you a free auto-renewing cert.
A process supervisor
systemd (or PM2) keeps the server running, restarts it on crash, and starts it on boot.
A deploy pipeline
CI builds, ships the standalone bundle over SSH, and restarts - push-to-deploy without the platform.
The steps
Build standalone
// next.config.js
module.exports = { output: "standalone" };
// then:
next build // emits .next/standalone with a minimal server.jsRun it on the server
# copy .next/standalone + .next/static + public to the box, then:
PORT=3000 node server.jsPut a reverse proxy + SSL in front
# Caddy - one line, auto HTTPS:
yourdomain.com {
reverse_proxy localhost:3000
}Supervise and deploy
Wrap node server.js in a systemd unit (Restart=always), and let your CI pipeline ship new builds and restart - health-gated, with rollback.
What you handle yourself now
Leaving the platform means owning the conveniences it ran for you: incremental static regeneration needs a persistent filesystem or a shared cache; image optimization needs a self-hosted loader or a CDN; edge functions move to your Node server or a worker; preview deploys become a staging environment you set up. None of it is hard, but it is yours now - so be honest about which features you actually depend on before you leave. Many apps use far fewer than they think.
Put real numbers on the decision: the self-hosting cost estimator shows the VPS price and savings, the exit-cost calculator shows what leaving costs, and the migration scaffold generator gives you the Dockerfile and compose to start.
The operations the platform did for you
The reason people stay locked in is not the framework - it is the day-2 operations the platform quietly handled: deploys, supervision, SSL, health, rollback, logs. On your own servers, Infraveil gives you those back as one governed layer - health-gated deploys with rollback, process supervision, an audit trail - so leaving the platform means owning your stack, not rebuilding its operations by hand. The framework was never the lock-in; the operations were.
Frequently asked questions
Can Next.js really run without Vercel?
Yes. Next.js is open source and ships a standard Node server - next build then next start (or the standalone server) runs the same app on any machine with Node. The platform adds managed edge, ISR, and image optimization on top, convenient but not required.
What do I lose by leaving, and how do I replace it?
Mainly managed conveniences: ISR, edge runtime, image optimization, preview deploys. You can reproduce most - ISR with a persistent filesystem/cache, images via a self-hosted loader or CDN, edge logic on your Node server. Be honest about which you actually use.
What is output: standalone and why use it?
It makes the build emit a self-contained folder with a minimal server.js and only needed dependencies, so you run node server.js without the full node_modules. Cleanest way to self-host: smaller bundles, faster starts, no surprise about what is included.
Is it worth leaving the platform?
Depends what is hurting. Surprise bills, per-request pricing at scale, or wanting infrastructure you control - self-hosting pays off; a small VPS runs a lot of Next.js for a flat cost. If you lean on edge/ISR and traffic is modest, the convenience may be worth it. Measure exit cost and run-it-yourself cost first.
Client-side, no signup — they run in your browser.