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.
What is Next WP?
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.
Key Features
- Type-safe WordPress API — All WordPress queries are wrapped in typed functions inside
lib/wordpress.tswith definitions inlib/wordpress.d.ts, covering posts, pages, categories, tags, authors, paginated queries, and search. - Server-side pagination —
getPostsPaginated(page, perPage, filters)returns post data plus total and page headers, making it straightforward to render large content sets efficiently. - Automatic cache revalidation — The included
next-revalidateWordPress plugin sends a webhook to the/api/revalidateendpoint whenever content changes, invalidating only affected cache tags. - Dynamic route coverage — The starter includes routes for individual posts, pages, authors, categories, and tags, plus archive listing pages for each taxonomy.
- Search and filtering — A debounced search input component (
components/posts/search-input.tsx) provides real-time filtering, supported by API search helpers for categories, tags, and authors. - Dynamic sitemap and OG images —
/sitemap.tsgenerates an XML sitemap from all post slugs and modified dates, while/api/ogproduces Open Graph images for social sharing. - Dark mode and UI kit — The interface uses shadcn/ui components with Tailwind CSS v4 and includes a theme toggle in
components/theme/. - One-click deployment options — Deploy on Railway spins up a full stack: MySQL 8.0, WordPress with the pre-installed plugin, and the Next.js app via a custom Docker image; Vercel deployment works with an existing WordPress site after you install the plugin manually.
Who is Next WP for?
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.
What can you do with Next WP?
- Launch a blog or news site — Connect your WordPress instance, customize navigation in
menu.config.ts, and get a performance-focused blog with automatic sitemap updates. - Build a corporate or portfolio site — Use the static page routes and dynamic archive pages to display company content, team author pages, and category-based sections.
- Create a headless WordPress reference implementation — Study the source to see how the API layer, cache revalidation, and metadata generation are structured.
How does Next WP work?
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.
Pros and cons
- Pros: Fully typed API layer, built-in testing with Vitest, dark mode, dynamic OG images, and a per-page cache revalidation strategy.
- Cons: Requires a WordPress site with REST API enabled; Vercel deployment does not include the WordPress backend and forces manual plugin installation and configuration.
Pricing
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.
FAQ
What is Next WP?
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.
What are the prerequisites for Next WP?
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.
How does cache revalidation work?
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.
Does Next WP include WordPress itself?
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.
Is Next WP free?
Yes, the template is open source under the MIT License. You can use and modify it freely, including for commercial projects.








