Configuration

Public build-time env configuration

The legacy next.config env option embeds values at build time and is not recommended as a general configuration strategy. Even keys without NEXT_PUBLIC can be exposed. Prefer explicitly public build variables for public labels and server-only runtime access for secrets. Do not treat a config object as a secret store. Source: https://nextjs.org/docs/app/api-reference/config/next-config-js/env. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
env: Record<string,string>

Working Example

Example Snippetnextjs
export default {env:{PUBLIC_CATALOG_LABEL:'Reading room'}}
Next.js Reference