Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Modular Contentful + Next.js + Tailwind boilerplate with typed dynamic content modules
Next Modular Contentful is an open-source boilerplate that pairs the Next.js App Router with Contentful as a headless CMS and Tailwind CSS to create a typed, modular page-building system.
Next Modular Contentful is a starter project for building content-driven Next.js sites where editors compose pages from modular content types stored in Contentful. It takes Contentful entries — a published Page and a GlobalSettings entry — as input and renders them as typed React components with localization and revalidation built in. It was created by Jakke Korpelainen for a client in about 28 hours and then published as a public boilerplate with the client's permission. The repository includes a live demo that loads content from the author's demo space.
src/app/[lang]/[page] and server-side rendering.src/app/components/DynamicContent/index.tsx, and new modules follow the existing implementations.src/types/Language.ts and setting DEFAULT_LANGUAGE, supportedLanguages, LanguageNames, and LanguageCodes in src/lib/localization.ts.CONTENTFUL_* environment variables in .env.development, .env.production, and optional .env.local.src/app/[lang]/[page]/page.tsx and src/lib/contentful.ts.next-modular-contentful-data package replicates the modular Contentful content types to a new space using contentful-cli.Next.js developers who want a ready-made Contentful integration can clone the repo and start with a working localized site instead of wiring up the CMS themselves. Agencies and freelancers delivering client sites can use the modular system to let editors compose pages from predefined Contentful modules and customize components per project. Content teams can manage pages, global settings, and localized content through Contentful's editor while developers control the rendering and revalidation behavior.
src/lib/localization.ts and produce localized pages using Contentful locales.Install with npm install on Node.js 16.8 or later, then run npm run dev to start the development server at http://localhost:3000. To connect your own Contentful space, create or sign into a Contentful account, create a space, create API keys under /api/keys, and use the companion next-modular-contentful-data repo with contentful-cli to replicate the content types. Then set the CONTENTFUL_* environment variables, configure languages, and publish a Page plus a GlobalSettings entry.
Node.js 16.8 or later is required. After cloning, run npm install and npm run dev; the site defaults to the author's demo Contentful space, so it works out of the box before you configure your own API keys.
Yes, localization is built in. You define known languages in src/types/Language.ts and set DEFAULT_LANGUAGE, supportedLanguages, LanguageNames, and LanguageCodes in src/lib/localization.ts to match the locales enabled in Contentful.
The dynamic module system maps Contentful entry types to React components via src/app/components/DynamicContent/index.tsx. You can implement new typed modules by following the pattern of existing modules in that directory.
Yes, a demo is available at https://next-modular-contentful.jakke.fi/en-US/home. By default, the development server loads content from the same demo space until you configure your own.
Yes, the revalidation time is configurable in src/app/[lang]/[page]/page.tsx and src/lib/contentful.ts, so you control how frequently Contentful changes trigger static regeneration.
