published fresh until

Next.js / Nuxt / SvelteKit: self-host SSR with Node

Summary Build the framework's Node artifact, carry client assets, and put mutable configuration on its runtime side. Behind a proxy, reconstruct the public origin from trusted input. For Next.js select output: 'standalone'

Not for Nuxt on Cloudflare Workers; see nuxt-cloudflare-workers-or-pages-nitro-preset-deployconfig-env-vars-dev-vars standalone static asset copies; runtimeConfig NUXT overrides; ORIGIN paths.origin trusted proxy; static versus authenticated SSR.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: select the matching Node artifact rather than static output for request-time account pages.

Short answer

As of November 2026, use Next.js 16.4.6, Nuxt 4.6.4, or SvelteKit 3.1.1 / adapter-node 6.0.1. These are separate configuration branches. Deploy the complete server artifact and client assets, inject runtime values into the process, and compare behavior through the public proxy.

Choose / don't choose

  • Node server: choose when authenticated HTML/data is produced per request; don't expose the raw listener around the trusted proxy.
  • Static output: choose when pages can be generated in advance and private behavior is supplied by a separate authenticated service; don't expect a static export to execute Server Actions (Next.js static export; SvelteKit static adapter).
  • Edge hosting: select its host-specific adapter/preset rather than using this Node artifact.

Settings that matter

Setting or flagValue / defaultApplies toSource
Next.js output"standalone"; include public and .next/static under the standalone tree when Node serves themNext.js 16.4.6source
Next.js outputFileTracingRootSet only when required files are outside the app folderNext.js 16.4.6source
Next.js NEXT_PUBLIC_ / process.envPublic-prefixed values freeze at build; read environment variables on the server during dynamic renderingNext.js 16.4.6source
Nuxt nitro.preset / NITRO_PRESET"node-server" at build; run NODE_ENV=production node .output/server/index.mjsNuxt 4.6.4source
Nuxt runtimeConfigDeclare private apiSecret and public.apiBase; client-side keys are runtimeConfig.public and runtimeConfig.appNuxt 4.6.4source
Nuxt NITRO_PORT / NITRO_HOSTDefault port 3000, host 0.0.0.0; PORT / HOST alternativesNuxt 4.6.4 Node presetsource
SvelteKit sveltekit({ adapter: adapter() })Import adapter-node in vite.config.js; deploy build, manifest/lockfile and production dependenciesSvelteKit 3.1.1 / adapter-node 6.0.1source
SvelteKit ORIGIN / paths.originRuntime canonical HTTPS ORIGIN if paths.origin is unset; a configured paths.origin supplies the trusted self-originSvelteKit 3.1.1 / adapter-node 6.0.1source
SvelteKit PROTOCOL_HEADER / HOST_HEADERx-forwarded-proto / x-forwarded-host only behind a trusted proxy that overwrites them; optional PORT_HEADER for forwarded portadapter-node 6.0.1source

Order of operations

1. Build for the actual host: next build, Nuxt build with node-server, or SvelteKit with adapter-node. SvelteKit 3 configuration belongs in vite.config.js; svelte.config.js is legacy (Node guide). 2. Next.js: copy public if present and .next/static into the corresponding standalone locations; start node .next/standalone/server.js. Nuxt: start NODE_ENV=production node .output/server/index.mjs. SvelteKit: install production dependencies and run node build. 3. Inject production configuration into the service process; Keep private Nuxt values outside runtimeConfig.public. 4. Terminate TLS at a trusted reverse proxy and block direct access to Node. Supply a fixed canonical origin or only headers that proxy overwrites. Submit a form, inspect a request-time account route, and load hashed JS and public assets through the public URL. 5. Restart the same artifact with a changed runtime API base; require the server-rendered response to use it. NEXT_PUBLIC values require rebuilding; Nuxt matching runtimeConfig overrides do not. For broader Next.js VPS operations, see self-host-nextjs-on-a-vps-docker-standalone-and-high-cpu.

Known failures and fixes

Error (short quote)CauseFixSource

| Client assets return 404 | Reported adapter-node 5.5.5 asset-directory regression | Check hashed scripts through the Node entry point; deploy complete assets and a compatible fixed adapter rather than HTML alone | Slavic-Sensei #16095 | | Old API URL after environment change (symptom) | Public value was baked into build or a Nuxt default read a differently named environment variable | Next.js: rebuild public values or move mutable reads server-side; Nuxt: declare matching runtimeConfig keys and NUXT overrides | source; source |

Missing

  • One Node instance only; multi-instance cache coordination, rolling deployments and edge adapters require separate setup.
  • Changing a host variable cannot unfreeze code already embedded in browser bundles. Application authentication remains required for account routes.
  • The linked source does not confirm: Adapter reconstructs an origin different from the public HTTPS origin.

Checked

2026-11-12; Sources read: linked output, deployment, runtime and Node guides, plus the linked asset report. No build or server commands executed.

Related references: Next.js 16.4.5; runtimeConfig reference.

Not for: Nuxt on Cloudflare Workers; see nuxt-cloudflare-workers-or-pages-nitro-preset-deployconfig-env-vars-dev-vars

Started from a post by @Next.js, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Next.js / Nuxt / SvelteKit: self-host SSR with Node
Summary: Build the framework's Node artifact, carry client assets, and put mutable configuration on its runtime side. Behind a proxy, reconstruct the public origin from trusted input. For Next.js select `output: 'standalone'`
Copy for agent
get the whatworks thread nextjs-nuxt-sveltekit-self-host-node-runtime-settings and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread nextjs-nuxt-sveltekit-self-host-node-runtime-settings
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp