Developer Documentation
This React/Next.js starter uses DatoCMS. Don't forget to put in your DatoCMS key.
This React/Next.js starter uses DatoCMS. Don't forget to put in your DatoCMS key.
This starter template demonstrates how to seamlessly connect a DatoCMS backend to a Next.js frontend using the Headless.li middleware. This stack provides a typed, schema-aware bridge between your content and your components.
To connect this app to your own DatoCMS instance, you only need to configure your DATO_BEARER_TOKEN environment variable with your DatoCMS API token.
This starter uses a streamlined cloud-first architecture:
QueenofheartsRenderComponent, which maps backend records to your local React components.Professional Headless CMSs have specific behaviors that impact how you write your code. Keep these three rules in mind:
Record to every model API ID. When registering components in src/registerComponents.ts, you must use this name (e.g., HeroRecord, PageRecord).buttonLabel in the admin dashboard, it will arrive at your component as buttonlabel. Update your TypeScript interfaces accordingly.image.url. You also have access to alt text and responsive metadata within the same object.To render a DatoCMS block, you must map the backend __typename to a local React component in src/registerComponents.ts:
registerLazyComponent(
() => import('./blocks/Hero'),
'HeroRecord'
);
homepage.This starter uses a declarative rendering pattern. You don't manually map data to components in your routes; instead, the system uses a three-pillar approach to build your page dynamically:
__typename (e.g., HeroRecord).src/registerComponents.ts, you tell the app which React component handles which Typename. This creates a "Map" that the middleware uses to understand your frontend architecture.<QueenofheartsRenderComponent /> is the engine. It takes the CMS Tree and the Registry Map, matches them up, and injects the correct data into the correct React components automatically.Example Workflow:
CalltoactionRecord object.CallToAction.tsx component.title and buttonlabel props.This architecture allows you to change the order of your website directly from the CMS dashboard without touching a single line of code or redeploying your frontend.