Framework Deploy

Deploy Next.js apps on your own VPS

Last updated June 15, 2026
Reviewed by Better-PaaS team

Deploy Next.js applications from Git with Better-PaaS, Nixpacks, Docker containers, automatic HTTPS, logs, and rollback support.

Overview

Better-PaaS can deploy Next.js projects from a Git repository or Docker image. The platform builds the app, runs it in a container, routes traffic through Caddy, and gives you logs, env vars, domains, databases, and rollbacks from the dashboard.

What Better-PaaS expects

Next.js projects should have a clear build and start path. For this stack, the common shape is Node.js applications with build output and a start command. If Nixpacks does not detect the project correctly, use explicit build/start commands or a Dockerfile.

Deployment steps

Connect the repository, choose the branch, set environment variables, attach any database, deploy, then verify the app responds on the platform-provided port. Better-PaaS will handle container lifecycle and HTTPS routing after the app is healthy.

  • Connect Git repository
  • Set build and runtime variables
  • Add Postgres, Redis, or MySQL if needed
  • Deploy and inspect logs
  • Add domain and verify HTTPS

Common mistakes

The most common issue is hard-coding a port instead of listening on the provided PORT variable. Build failures usually come from missing lockfiles, missing scripts, or framework detection that needs a custom Dockerfile.

Next.js production settings on Better-PaaS

Use next start after next build. App Router projects need Node 18+. Set NODE_ENV=production.

  • Lockfile required for reproducible Nixpacks builds
  • Use standalone output + Dockerfile if image size matters
  • Separate server secrets from NEXT_PUBLIC_* client vars
  • Health check path: / or /api/health

FAQ

Can Better-PaaS deploy Next.js from Git?

Yes, when the repository can be built by Nixpacks or by a Dockerfile you provide.

Can Next.js apps use databases?

Yes. Better-PaaS can provision Postgres, Redis, and MySQL containers and inject connection variables into apps.