Step-by-step guide

Deploy Next.js with Standalone Output

Build and run a minimal Next.js standalone deployment, including the static assets, environment variables, proxy, and health checks production requires.

By HostNextJS Editorial TeamReviewed by HostNextJS Technical Review Published Updated
01Typeguide
02Last reviewed
03Update policyReview every 90 days and after a material Next.js output or self-hosting change.
At a glance

Deployment sequence

  1. STEP 01

    Enable standalone output

    Set output to standalone in next.config.js and commit the configuration.

  2. STEP 02

    Build and assemble the release

    Run the locked production build, then include public and .next/static when the server will serve those assets.

  3. STEP 03

    Run behind a reverse proxy

    Start the generated server.js under supervision and terminate public traffic through a configured reverse proxy.

  4. STEP 04

    Verify and retain rollback

    Check health, dynamic routes, images, streaming, and assets before switching traffic; retain the prior release.

Standalone output is a packaging mode, not a hosting platform. It traces the files your production server needs and writes a minimal runnable release to .next/standalone.

Configure the build

Set output: "standalone" in next.config.js, install from the lockfile, and run the normal production build. Test the generated server with the same Node.js major version and environment categories you intend to use in production.

The trace is rooted at the Next.js project by default. In a monorepo, files outside that root may need outputFileTracingRoot; runtime files missed by tracing may need narrow outputFileTracingIncludes rules.

Assemble a complete release

The generated directory contains a minimal server.js and traced dependencies. It does not copy public or .next/static by default. Copy those directories into the standalone tree when the Node.js server will serve them, or publish them through a CDN with a deliberately configured asset path.

Keep build-time and runtime values distinct. Variables prefixed with NEXT_PUBLIC_ are embedded during the build and cannot be changed by updating only the runtime environment.

Operate the server

Run server.js with a process supervisor, an explicit host and port, and a non-root service account. Put Nginx or another reverse proxy in front of the process for TLS, request limits, and public network controls. If the application streams responses, verify that every proxy layer passes the stream instead of buffering it.

Use a release directory or immutable image so a failed deployment can switch back to the previous artifact. A successful process start is not enough: request a representative dynamic route, a static asset, an optimized image, and a health endpoint before directing production traffic to the release.

Methodology

How this resource was produced

This guide follows the documented Next.js standalone build process and treats the generated server, static assets, runtime configuration, reverse proxy, and release verification as separate deployment concerns.

Limitations
  • 01

    Standalone output reduces the runtime bundle; it does not configure TLS, process supervision, backups, monitoring, or rollback.

  • 02

    Monorepos and native dependencies can require explicit output tracing configuration.

Evidence

Sources and review record

Primary documentation checked for the material claims on this page. Product behavior and prices can change after the checked date.

  1. 01 · Next.jsNext.js output configurationChecked July 12, 2026
  2. 02 · Next.jsHow to self-host your Next.js applicationChecked July 12, 2026
FAQ

Questions about deploy next.js with standalone output.

No fog. Just the practical details developers need before moving a production app.

Does standalone output include public and static files?

Not by default. Copy public and .next/static into the matching standalone directories, or serve them from a separate asset host.

Can I run standalone output without installing node_modules?

The generated standalone directory includes the traced runtime dependencies needed by the minimal server, subject to output tracing caveats.

Next step

Turn the resource into a deployment decision.

Discuss a standalone deployment