The three options
- Vercel: the simplest. You connect the repository and every push is published automatically. Ideal to start and for small projects; costs can grow with traffic.
- Your own VPS: you build with
next buildand run it withnext startbehind Nginx. Cheaper and more controllable, but you operate the server. - Docker: you package the app (with
output: 'standalone'the image stays light) and run it on any server or container service.
The steps on a VPS, in short
- Prepare the server: Node.js LTS, non-root user, firewall (ports 22, 80 and 443).
- Clone the project, install dependencies and run
npm run build. - Set the environment variables before the build (public ones) and on the server (private ones).
- Keep the app alive with PM2 or systemd running
npm run start. - Nginx as a proxy to port 3000 and HTTPS with Let’s Encrypt.
- Automate the build and restart with GitHub Actions.
Common mistakes
- Building on a server with little memory and the build dies halfway; build in your pipeline or add swap space.
- Forgetting that optimized Next.js images need allowed domains configured.
- Publishing private keys with the
NEXT_PUBLIC_prefix. - Not defining the site URL, so links or SEO point to localhost.
How we help
We tell you which of the three routes suits you based on your budget and traffic, and leave it running with a domain, HTTPS and automatic deploys.