n nesly

Deploy Next.js

How nesly detects, builds and serves a Next.js project — and the two commands that put it on a live URL.

Deploy Next.js on nesly

A Next.js project is served statically or run as a server, depending on how the project is configured.

cd your-project
nesly deploy --yes

The first deploy creates the project and prints the live URL; after that, nesly deploy is enough.

How detection sees it

  • A package.json depending on next is detected as Next.js.
  • Next is treated as a server framework and run as a container — unless next.config.* sets output: 'export', in which case the out/ directory is built and served as static files.
  • Dependencies are installed with the package manager your lockfile says: pnpm-lock.yaml means pnpm, yarn.lock means yarn, otherwise npm. The packageManager field wins over all of them.

When detection is not what you want, say it yourself: build and start commands, root directory and output directory live in nesly.toml committed next to the code — see builds.

Worth knowing

  • Environment variables an in-browser page needs must be prefixed NEXT_PUBLIC_ and set before the deploy — they are baked in at build time.
  • The server binds the port the platform provides in PORT; next start honours it, a custom server.js must read it.
  • Attach a managed database with nesly addon add postgres (or mssql) — connection env vars are injected on the next deploy.
  • When a deploy fails, nesly diagnose reads the logs for you and names the fix.

Full walkthrough: get started. Custom domains, backups, GitHub deploys and the rest of the reference: nesly CLI.