Configuration
Contents
The adapter reads its connection and mapping settings from Next.js environment variables. Keep environment-specific values outside committed files when they contain secrets.
Server variables
| Name | Required | Purpose |
|---|---|---|
|
|
Yes |
Absolute URL of the Enonic XP API root, for example |
|
|
Yes |
XP application key that owns the content types and component descriptors used by the project. |
|
|
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 |
Guillotine API appended to |
|
|
No |
Base URL for images and attachments. Default: |
|
|
No |
Enonic admin URL, used for CORS when the admin is served from a different domain than the API. Default: the origin of |
|
|
No |
Enables adapter diagnostic logging when configured by the application. |
ENONIC_API=https://xp.example.com/api
ENONIC_APP_NAME=com.example.site
ENONIC_MAPPINGS=en:website/site,no:website-no/site
ENONIC_API_TOKEN=replace-with-a-long-random-value
Development-only diagnostics and catch-all behavior are enabled when NODE_ENV is development, as under next dev.
Browser-visible variables
When common adapter exports are used in client bundles, publish the non-secret equivalents explicitly:
NEXT_PUBLIC_ENONIC_API=$ENONIC_API
NEXT_PUBLIC_ENONIC_APP_NAME=$ENONIC_APP_NAME
NEXT_PUBLIC_ENONIC_MAPPINGS=$ENONIC_MAPPINGS
NEXT_PUBLIC_ENONIC_MEDIA_CDN=$ENONIC_MEDIA_CDN
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.