Nuxt · Runtime config

NUXT0053Use runtimeConfig instead of process.env in app code

Flags plain env in app code in Nuxt runtime code before it leaks into runtime behavior.

Why it happens

Runtime configuration has different server and client visibility. Using the framework API keeps environment data typed and scoped.

Fix

Read configuration through useRuntimeConfig() instead of process.env in app code.

Example

Use runtime config in app code

Before

const apiBase = process.env.NUXT_PUBLIC_API_BASE

After

const apiBase = useRuntimeConfig().public.apiBase

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules nuxt/runtime/no-plain-env-in-app-code
Copyright © 2026