

Welcome to the exciting world of Payload CMS and NextJS! In this article, we'll dive deep into how to effectively combine these powerful tools to build dynamic websites. This guide is based on the insightful series created by AllAboutPayload, specifically designed for developers looking to enhance their web development skills. Let’s get started!
This article is the written step-by-step companion to our video tutorial, which you can find on YouTube at the following link: https://www.youtube.com/watch?v=Z3c7Y-Q5CuQ. For visual learners or those who prefer following along with video instruction, the video covers the same content and provides additional context and real-time demonstrations of each step in the process.
Throughout this series, we will cover several key topics to help you understand how to leverage Payload CMS with NextJS:
It's essential to understand the scenarios where using Payload CMS in combination with NextJS makes the most sense:
This is the most popular use case. If you’re looking to create a website, combining these two technologies is highly beneficial.
For projects like CRM systems or support ticket management tools, Payload can be used standalone while integrating custom React components into its admin panel.
If you want to build your own SaaS product, it’s advisable to have a separate front end that utilizes Payload as an API for the back end, allowing for custom layouts and designs.
In this series, we will focus primarily on building a website, as it represents the most common scenario.
When working with Payload CMS and NextJS, we recommend using two separate repositories:
By separating these two components, you can take advantage of Vercel's features, such as:

The costs associated with hosting your back end and front end can vary based on the complexity of your project and the volume of editing traffic:
Additionally, you will need:
One common question we often receive is whether Payload is similar to WordPress. The answer is nuanced:
While both are content management systems, the primary difference lies in their architecture:

To create a website using Payload and NextJS, you will need to build templates. These templates should include placeholder values that will be filled with actual data from the CMS during build time. Here’s how it works:
This approach allows you to efficiently manage content while ensuring that your front end is always up-to-date with the latest information.
In this tutorial series, we will utilize the old pages router. While there’s a new app router available, we believe it's beneficial to stick with the familiar structure for now. This decision is made to ensure that the series remains accessible to those who have been using the pages router up until this point.
Although you can combine both the back end and front end into a single repository, we prefer to keep them separate. This separation allows for:
There are specific plugins and packages available for integrating Payload into a NextJS project. The most notable one is next-payload. However, we advise waiting for Payload version three, which will offer native NextJS support, thus avoiding potential issues and incompatibilities.

When hosting your project on Vercel, be mindful of cold starts in serverless functions. Unlike traditional servers that run continuously, serverless functions spin up as needed. This means there may be a slight delay when accessing the admin panel, as Vercel initiates the function.
One of the most exciting features we’ll explore is implementing a live preview. This allows you to see how content entered into Payload appears on the front end in real time. This feature is invaluable for ensuring that your content looks exactly as intended before it goes live.
Finally, we will discuss SEO strategies and performance optimization for your NextJS site. Ensuring that your website is not only visually appealing but also optimized for search engines is crucial for attracting and retaining visitors.
In summary, combining Payload CMS with NextJS offers a powerful solution for building dynamic websites. This series will guide you through the intricacies of setting up and optimizing your projects, ensuring you have a solid understanding of both technologies. Don't forget to check out the entire series on the YouTube playlist for more in-depth tutorials.
Payload is a headless content management system that allows developers to manage content without generating a front end. It acts as a hub for data, enabling flexible content management.
NextJS is a React framework that enables server-side rendering and static site generation, providing better performance and SEO capabilities compared to traditional single-page applications.
Yes, Payload can be used independently, but you will miss out on the dynamic capabilities and optimized performance that NextJS offers.
Serverless functions allow you to run backend code without managing servers. They spin up on demand, which can lead to cold starts but also provide scalability and flexibility.
While Payload itself may have costs associated with hosting, it offers a free tier for development and small projects, making it accessible for many users.
Stay tuned for the next part of the series, where we will dive into building dynamic pages in Payload and integrating them into your NextJS front end!