Deployment

Standalone server startup

Single-project standalone smoke-test procedure for a reviewed local build. Build with synthetic environment values, inspect artifact contents and include assets if present. The commands copy directory contents into the intended destination, avoiding an extra nested public directory. Start on loopback; stop when finished. Monorepo paths may differ. Source: https://nextjs.org/docs/app/api-reference/config/next-config-js/output. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
HOSTNAME=127.0.0.1 PORT=3000 node .next/standalone/server.js

Working Example

Example Snippetnextjs
npm run buildif [ -d public ]; then  mkdir -p .next/standalone/public  cp -R public/. .next/standalone/public/fimkdir -p .next/standalone/.next/staticcp -R .next/static/. .next/standalone/.next/static/HOSTNAME=127.0.0.1 PORT=3000 node .next/standalone/server.js
Next.js Reference