Netlify Developers

Compose Conference 2024 is coming!  Submit a talk

How to deploy Payload CMS to Netlify

by Matt Kane

Payload is a self-hosted headless CMS. With the new 3.0 beta release it is now built on Next.js, making it easy to deploy to Netlify. In this guide, we’ll show you how to deploy Payload CMS to Netlify either standalone or as part of your existing Next.js site.

TL;DR

Payload 3.0 beta is built on Next.js, so it can be deployed to Netlify in just a few clicks. Discover the command you need to add it to an existing Next.js project, and find an example site to deploy and explore.

What is Payload?

Payload is a self-hosted headless CMS. It lets you deploy your own headless CMS, backed by your own MongoDB or PostgreSQL database, and keep in control of your own data.

What’s new in Payload 3.0 beta?

The new 3.0 beta release of Payload is built on Next.js, and no longer relies on running a separate Express server to host the admin and API. It’s easy to deploy either as a standalone CMS or as part of an existing Next.js site. Because it’s a regular Next.js site, it can be deployed to a serverless Next.js platform like Netlify, rather than needing to run in a Docker container or similar Node server. Adding it to an existing Next.js site is as simple as running a single command.

Warning!

Payload 2.0 cannot be deployed to Netlify or any other serverless platform because it needs to run a standalone Express server. Attempting to deploy to Netlify can cause expected problems.

Choosing a database

Payload can use either MongoDB or PostgreSQL as a database. Make sure you have a database set up before you start, and copy the connection string to use in the Payload setup. If you choose Supabase for your Postgres database, you can use the Supabase integration for Netlify.

How to install Payload 3.0 beta on your Next.js site

Warning!

Payload 3.0 is BETA software and the Payload team warns that you are 100% guaranteed to run into bugs / weird stuff. They are actively working toward a stable release as fast as they can.

You can add Payload to your Next.js project with a single command:

Terminal window
npx create-payload-app@beta

This will deploy Payload alongside your existing Next.js site.

Try the Payload 3.0 beta demo

To deploy Payload you need a database connection string and a secret key. The secret key can be any random value. On Mac or Linux you can generate a random secret with the following command:

Terminal window
openssl rand -hex 16

Copy that value to use as your secret key. Once you have setup your database and generated a random secret, you can deploy the demo to Netlify to explore Payload 3.0 beta:

Deploy to Netlify