Deploy a Next.js app to production
Next.js is what most AI tools reach for when you ask for 'an app' — v0, Cursor, and Claude Code all emit it by default. It runs anywhere Node runs: Launchmatic builds it as a standalone server in a container, with none of the serverless function limits.
How detection works
A next dependency in package.json. Nixpacks selects the Node provider, runs next build, and starts with next start (or your start script).
Build configuration & gotchas
Standalone output (recommended)
Set output: "standalone" in next.config.js for a dramatically smaller image — Next bundles only the needed node_modules into .next/standalone. Without it the build still works, just heavier.
Port binding
Launchmatic injects PORT; next start honors it automatically. If an agent wrote a custom server.js, make sure it listens on process.env.PORT, host 0.0.0.0.
Image optimization
next/image works out of the box in a container (it uses sharp at runtime). No external image CDN config needed.
ISR & middleware
ISR revalidation runs in-process on the single server — fine for most apps. Edge middleware executes as normal Node middleware; there is no separate edge network.
Environment variables
DATABASE_URLInjected automatically when you link a Launchmatic Postgres.NEXT_PUBLIC_*Inlined at build time — set them before `lm deploy`, not after.next.config.js for the leanest container build:
/** @type {import('next').NextConfig} */
module.exports = {
output: "standalone",
};FAQ
Do I lose anything by not deploying Next.js to Vercel?+
You trade Vercel's global edge network for a long-running server: WebSockets work, there are no function timeouts, and pricing is flat. Heavily edge-dependent features (edge ISR, regional middleware) are the exception — see our Vercel comparison for the honest breakdown.
Ready to deploy?
Free to start. No credit card. Auto-SSL on custom domains, managed Postgres, and per-branch preview deploys included.
This guide is part of our complete vibe coding hosting guide — how to take any AI-built app to production.