Starter configuration

Contents

Configure the starter through Next.js environment files and next.config.js. Use deployment secrets or .env.local for values that must not be committed.

Environment

A minimal local configuration is:

ENONIC_API=http://127.0.0.1:8080/site/
ENONIC_APP_NAME=com.example.site
ENONIC_MAPPINGS=en:website/site
ENONIC_API_TOKEN=replace-this-secret

NEXT_PUBLIC_ENONIC_API=$ENONIC_API
NEXT_PUBLIC_ENONIC_APP_NAME=$ENONIC_APP_NAME
NEXT_PUBLIC_ENONIC_MAPPINGS=$ENONIC_MAPPINGS

The browser-visible variables contain routing and API location information, not credentials. Do not create NEXT_PUBLIC_ENONIC_API_TOKEN.

See Configuration for the complete variable reference and Projects and localization for mapping syntax.

Shared secret

ENONIC_API_TOKEN protects all three integration routes. Set the same value as nextjs.<name>.secret in com.enonic.app.nextxp.cfg. Rotate both sides together.

Component registry

Replace the catch-all development mapping with explicit application mappings. Keep this import before custom registrations:

import '@enonic/nextjs-adapter/baseMappings';

Set a shared query only when multiple views need the same data. Its result is added to props.common throughout the page tree.

Rendering and caching

The starter demonstrates an hourly revalidate value and static-path generation. These are examples, not requirements. Choose static, revalidated, or dynamic rendering according to the site’s freshness and scale requirements.

Keep transpilePackages, the @phrases aliases, and the Content Studio-compatible response policy when modifying next.config.js.


Contents

Contents