Contents

Build a website on the Brain CMS

Read published pages, entries and menus from your website's server and refresh on publish.

Set up access

  1. In Nucleo, go to CMS > your site > Settings > For developers.
  2. Copy the base URL of the site.
  3. Select Create token and store the cmsdt_… value as a secret on your server — it is shown once.

The token reads only that site's published content. Call the API from your server or at build time: it does not accept browser calls, so the token never reaches visitors.

Fetch a page

Resolve the URL the visitor asked for into a page:

// Next.js (App Router): app/[...slug]/page.js
const BASE = "https://api-brain.nucleoplatform.com/api/delivery/v1/acme/sites/12";

async function nucleo(path) {
  const res = await fetch(`${BASE}${path}`, {
    headers: { Authorization: `Bearer ${process.env.NUCLEO_CMS_TOKEN}` },
    next: { tags: ["nucleo"] },
  });
  if (res.status === 404) return null;
  if (!res.ok) throw new Error(`Nucleo CMS: ${res.status}`);
  return res.json();
}

export default async function Page({ params }) {
  const { slug = [] } = await params;
  const page = await nucleo(`/page?path=/${slug.join("/")}&locale=en`);
  if (!page) return notFound();
  // render page.data …
}

Use /collections/{collection}/entries for blog posts and news, /menus for navigation, /redirects to apply the redirects your editors set and /sitemap to build sitemap.xml. All of it is in the Content Delivery reference.

Refresh when editors publish

Cache everything you fetch and let Nucleo tell you when to refresh: set a Revalidate URL and secret in the site settings and handle the call as shown in Webhooks.