Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A sample website frontend for Compose with Next.js
Compose Starter: Help Center + Next.js is a boilerplate frontend by Contentful that renders a localized help center website from a Compose-compatible content space using Next.js, TypeScript, and Tailwind CSS. It is designed as the frontend counterpart to Compose's "Simple website" content model for empty spaces, giving teams a ready-made article publishing site that can be deployed to Vercel in a few clicks.
It is a sample website frontend maintained by Contentful that connects to a Compose-compatible space through a delivery API key and a preview API key, reads content entries, and outputs a help center with locale-based routes. The project runs on Next.js 12.x with TypeScript 4.x and is styled with Tailwind CSS. It takes three environment variables as input — CF_SPACE_ID, CF_DELIVERY_ACCESS_TOKEN, and CF_PREVIEW_ACCESS_TOKEN — and produces a static or server-rendered website with article pages, index pages, and preview support.
[locale] directory in src/pages serves content under multiple locales, and each route can be accessed with a locale prefix.articles/[slug].tsx for individual help articles and a general [slug].tsx for other content pages, plus an index page per locale.src/components/renderer/block-renderer.tsx component maps a content type to the correct React component, which is how Compose preview entries are rendered.cf-content-types-generator tool to keep src/lib/generated-types in sync with the space via yarn generate-types.src/components or new routes in src/pages, then regenerate the TypeScript types after changing the space model.After cloning the repository, install dependencies with yarn, copy .env.example to .env, and fill in the three Contentful variables. Running yarn run dev starts the site at http://localhost:3000. For production, the README walks through importing the repository into Vercel, selecting a scope, adding the same environment variables, and completing the deployment.
The template requires CF_SPACE_ID, CF_DELIVERY_ACCESS_TOKEN, and CF_PREVIEW_ACCESS_TOKEN. These are the space ID, a delivery API key, and a preview API key for a Compose-compatible space, and are set in the project settings for local development and on Vercel.
The project includes a script called via yarn generate-types that uses cf-content-types-generator. It needs CF_SPACE_ID and CF_CMA_TOKEN exported as shell environment variables, and it writes the generated types to src/lib/generated-types.
Yes, there is a [locale] directory inside src/pages which is the Next.js dynamic route for locale segments. This lets the same help center serve articles in multiple languages as long as the content space provides localized entries.
The repository is open source under the MIT license, so it can be used and modified without licensing fees. It does require a Contentful space that supports Compose, which has its own pricing.
The README links to the Contentful community forum, a community Slack channel, and Contentful Customer Support for confidential issues. Bugs can be reported in the GitHub issues for the repository.
