Next.js adapter

Contents

@enonic/nextjs-adapter is the front-end library at the center of Next.XP. It queries Guillotine, builds renderable page structures, maps XP descriptors to React views, processes URLs and rich text, and supplies Content Studio editing metadata.

This page documents @enonic/nextjs-adapter 5, the adapter major that defines Next.XP 5.

The adapter depends on @enonic/react-components, which provides reusable XP-aware React components and types. Adapter 5 uses its RichText renderer for links, images, and macros, while the adapter’s own views handle the standard Next.XP page tree and its editing annotations.

Installation

npm install @enonic/nextjs-adapter

Adapter 5 requires Node.js 24.15.0 +, npm 10.9.2 +, Next.js 16, and React 19.

Entry points

Import Use

@enonic/nextjs-adapter

Types, constants, registry, localization, URL utilities, and other exports safe in shared application code.

@enonic/nextjs-adapter/server

Guillotine and content fetching. Import only from server components, route handlers, or other server code.

@enonic/nextjs-adapter/client

React locale context for client components.

@enonic/nextjs-adapter/views/<ViewName>

One default export per built-in React view.

Basic use

import {validateData} from '@enonic/nextjs-adapter';
import {fetchContent} from '@enonic/nextjs-adapter/server';
import MainView from '@enonic/nextjs-adapter/views/MainView';

export default async function Page({params}) {
    const resolved = await params;
    const result = await fetchContent({
        locale: resolved.locale,
        contentPath: resolved.contentPath || []
    });

    validateData(result);
    return <MainView {...result}/>;
}

Register application mappings before the first fetch. See Components and views.

API sections

  • Common API — registry, localization, URL handling, types, and constants

  • Server API — content, Guillotine, and static-path fetching

  • Client API — client-side locale context

  • Views — built-in renderers and their roles


Contents

Contents