Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A headless WordPress starter built with Next.js 16, React 19, TypeScript, and Tailwind CSS.
Next WP is a headless WordPress starter that pairs WordPress as a content backend with a Next.js 16 frontend built on React 19 and TypeScript, running on the Next.js App Router with React Server Components.
Next WP is an open-source boilerplate for building headless WordPress websites. It takes a WordPress site with the REST API enabled as its input and outputs a fully server-rendered Next.js application with support for posts, pages, author archives, category archives, tag archives, search, and an automatically generated XML sitemap. The project is maintained by Bridger Tower and Cameron Youngblood at 9d8 and is licensed under the MIT License. The repository includes the frontend application, a WordPress plugin for cache revalidation, and deployment templates for Railway and Vercel.
lib/wordpress.ts with definitions in lib/wordpress.d.ts, covering posts, pages, categories, tags, authors, paginated queries, and search.getPostsPaginated(page, perPage, filters) returns post data plus total and page headers, making it straightforward to render large content sets efficiently.next-revalidate WordPress plugin sends a webhook to the /api/revalidate endpoint whenever content changes, invalidating only affected cache tags.components/posts/search-input.tsx) provides real-time filtering, supported by API search helpers for categories, tags, and authors./sitemap.ts generates an XML sitemap from all post slugs and modified dates, while /api/og produces Open Graph images for social sharing.components/theme/.Next WP is aimed at developers and teams who want a headless WordPress architecture with minimal boilerplate. Next.js developers can use it as a learning reference for React Server Components, App Router patterns, and typed API integration. WordPress agencies can deliver modern frontends for client content while keeping the familiar WordPress editing experience. Content teams benefit from instant revalidation so edits appear on the live site without a full rebuild. Self-hosting users get a complete MySQL + WordPress + Next.js stack in one Railway deploy.
menu.config.ts, and get a performance-focused blog with automatic sitemap updates.After cloning the repository, you run pnpm install, copy .env.example to .env.local, and set WORDPRESS_URL, WORDPRESS_HOSTNAME, and WORDPRESS_WEBHOOK_SECRET. The Next.js app then fetches content from the WordPress REST API at request time, using fetch caching and Next.js cache tags. When a post is created or edited in WordPress, the next-revalidate plugin sends a POST request to your Next.js /api/revalidate endpoint with the secret, and only the affected pages are regenerated. The Railway template automates this by including the plugin and theme in its WordPress Docker image.
Next WP is open source under the MIT License, so the code itself is free. You only pay for hosting and infrastructure—either through Railway's services (MySQL, WordPress, Next.js) or through Vercel and your existing WordPress host.
Next WP is a starter template for building a headless WordPress site with Next.js 16. It uses the WordPress REST API as the content source and generates a server-rendered frontend with support for posts, pages, authors, categories, tags, search, and a dynamic sitemap.
You need Node.js 22.13 or later, pnpm 11 (enabled with Corepack), and a WordPress site with the REST API enabled (default since WordPress 4.7). For production, you'll also need somewhere to deploy the Next.js frontend, like Vercel or Railway.
The included next-revalidate WordPress plugin sends a webhook to your Next.js /api/revalidate endpoint whenever content changes. The endpoint validates the WORDPRESS_WEBHOOK_SECRET, then invalidates the specific cache tag for the affected content, so only those pages are rebuilt.
No. The repository contains only the Next.js frontend and a WordPress plugin. However, the Railway deployment template does include WordPress, MySQL 8.0, and the plugin in a custom Docker image, so you can get a full stack with one click.
Yes, the template is open source under the MIT License. You can use and modify it freely, including for commercial projects.
