Configuration
Contents
The adapter reads its connection and mapping settings from Next.js environment variables. Use .env for committed defaults and .env.local or deployment secrets for non-publishable values. See Starter environment for an example.
Server variables
| Name | Required | Purpose |
|---|---|---|
|
|
Yes |
Absolute URL of the Enonic XP API root, for example |
|
|
Yes |
Enonic application name, used in queries and component mappings. Must match the name of your XP application. |
|
|
Yes |
Comma-separated |
|
|
Yes, for preview and revalidation |
Shared secret used by the starter’s proxy and protected API routes. It must match the Next.XP app configuration. |
|
|
No |
Absolute media API base URL. Defaults to |
|
|
No |
Content Studio URL used to set CORS headers that let Content Studio access the preview. Defaults to the origin of |
|
|
No |
Enables adapter diagnostic logging when configured by the application. |
Development-only diagnostics and catch-all behavior are enabled when NODE_ENV is development, as under next dev.
Server and client configuration
Keep the variables above server-side; do not create NEXT_PUBLIC_ copies. Importing a common adapter export in a client component does not require exposing the environment configuration.
For custom client components, pass only the required non-secret data or resolved URLs from the server.
Never publish ENONIC_API_TOKEN. Values prefixed with NEXT_PUBLIC_ are embedded in browser JavaScript.
Next.js configuration
The starter configures @phrases for both webpack and Turbopack, transpiles @enonic/nextjs-adapter, supplies a Content Security Policy compatible with Content Studio embedding, sets CORS headers allowing the XP admin origin, and defines env.BUILD_ID, used to detect a draft cookie issued by another build. Preserve those settings when merging the integration into an existing Next.js application.
See Starter configuration for the complete connection between Next.js and the XP app.