This tutorial is published on Enonic's Developer Portal
This project is based on the Next.XP starter and contains a working version of the Next.js application, representing the end result of the tutorial, as well as the tutorial documentation in docs/.
The same application is used for the Next.XP demo.
Follow the demo to run the application. It can run locally, against an Enonic sandbox created from the Headless Movie DB template, or in the cloud, on Vercel against an Enonic Cloud solution.
The application needs a running Enonic back-end with the Headless Movie DB sample content. Requires Enonic XP 8.1+ with Guillotine 9 and the Next.XP app, added to the site.
The application is configured through environment variables in .env. The committed values target the demo back-end: the Headless Movie DB application (com.enonic.app.hmdb) with the project hmdb and a site at /hmdb, on http://localhost:8080.
| Variable | Description |
|---|---|
ENONIC_APP_NAME |
Name of the Enonic application that holds the content types and components |
ENONIC_API |
Absolute URL to the Enonic XP API root |
ENONIC_API_TOKEN |
Shared secret used to secure preview and revalidation requests |
ENONIC_MAPPINGS |
Maps locales to content projects and sites: <locale>:<project>/<site>, comma-separated |
GUILLOTINE_API |
Optional. Guillotine API descriptor, appended to ENONIC_API |
ENONIC_MEDIA_CDN |
Optional. Base URL for media, if it differs from ENONIC_API |
ENONIC_ADMIN |
Optional. Origin of Enonic admin, if it differs from the API origin |
To run against the back-end built in the tutorial, set ENONIC_APP_NAME=com.example.tutorial.nextjs and ENONIC_MAPPINGS=en:intro/hmdb. Put values that should not be committed in .env.local.
npm run dev # Start the application in development mode
npm run prod # Build and start the application in production mode
npm run lint # Run ESLint (also runs before every build)- Create new features in a branch
- Test and verify the application
- Update the docs if needed
- Create a pull request to
masteron GitHub - Tag
master, for examplegit tag v6.0.0, after the pull request is merged
- Move all relevant changes to a feature branch in starter-nextjs
- Test and verify the changes
- Create a pull request to
masteron GitHub - Tag
master, for examplegit tag v6.0.0, after the pull request is merged
- Merge the changes to
masterfor both repositories - Verify that setting up a new Next.js application works according to the tutorial
- Verify that the demo works
You can learn more in the Next.js documentation.
For the integration with Enonic, see @enonic/nextjs-adapter.