Nitro · NITRO0026

Read server settings from runtime config, not process.env

Flags process.env reads in Nitro server files.
NITRO0026vite-doctor/nitroruntime-configwarnSuggestion

Run this rule

pnpm vite-doctor . --framework nitro --rules nitro/runtime/no-process-env-in-server

Why it matters

Nitro maps NITRO_ and NUXT_ environment variables onto runtimeConfig at startup, with types and defaults in one place. process.env is empty on Cloudflare Workers and other runtimes without a Node process, and a key read straight from it bypasses that contract.

Declare the setting in runtimeConfig and read it with useRuntimeConfig(); override it with NUXT_<KEY> or NITRO_<KEY> at runtime.

Example

Read the mail sender from runtime config

Before

const from = process.env.MAIL_FROM

After

// nuxt.config.ts: runtimeConfig: { mailFrom: '' }, set with NUXT_MAIL_FROM
const { mailFrom } = useRuntimeConfig()
Copyright © 2026