This is a headless version of Wagtail's bakerydemo, built with Next.js and Wagtail REST API v2. It demonstrates how to use Wagtail as a headless CMS with a modern React-based frontend.
This site serves as a good demonstration of Wagtail’s built-in support for headless architectures. It requires running a copy of the Wagtail bakerydemo backend, switching to its headless branch which changes the site from serving content via HTML templates and an API to API-only mode.
- Clone this repository
- Install dependencies:
npm install- Configure your environment variables:
cp .env.example .env.localUpdate .env.local with your Wagtail backend URL.
- Start the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
- Server-side rendering of Wagtail pages
- Dynamic routing based on Wagtail page types
- Support for:
- Blog posts
- Bread types
- Locations
- Recipes
- Gallery
- Pagination for listings
- Image optimization using Next.js Image component
- Type-safe API integration
- Wagtail user bar
components/pages/- Page type components that correspond to Wagtail page modelslib/- API utilities and helpersmodels/- Zod schemas and TypeScript interfaces for Wagtail models
While we're not actively seeking contributions, feel free to raise issues or submit pull requests for feedback. This is an experimental project meant to demonstrate the capabilities of Wagtail as a headless CMS with Next.js.
This project is open source and available under the BSD 3-Clause License.