Convert Figma logo to code with AI

payloadcms logopayload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

24,367
1,544
24,367
480

Top Related Projects

63,346

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.

27,495

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.

The superpowered headless CMS for Node.js β€” built with GraphQL and React

5,221

Sanity Studio – Rapidly configure content workspaces powered by structured content

46,780

Independent technology for modern publishing, memberships, subscriptions and newsletters.

17,877

A Git-based CMS for Static Site Generators

Quick Overview

Payload CMS is a self-hosted, headless content management system and application framework built with Node.js, Express, and React. It provides a powerful and flexible solution for managing content, with features like authentication, file uploads, and a customizable admin panel.

Pros

  • Fully self-hosted and open-source, giving you complete control over your data and infrastructure
  • Highly customizable with a plugin system and extensible admin UI
  • Built-in TypeScript support for improved developer experience and type safety
  • Includes features like authentication, file uploads, and versioning out of the box

Cons

  • Steeper learning curve compared to some traditional CMS solutions
  • Requires more setup and maintenance as a self-hosted solution
  • Limited ecosystem of pre-built themes and plugins compared to more established CMS platforms
  • May require more development resources for complex customizations

Code Examples

  1. Defining a collection:
import { CollectionConfig } from 'payload/types';

const Posts: CollectionConfig = {
  slug: 'posts',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    {
      name: 'content',
      type: 'richText',
    },
  ],
};

export default Posts;
  1. Creating a custom field:
import { Field } from 'payload/types';

const CustomField: Field = {
  name: 'customField',
  type: 'text',
  admin: {
    components: {
      Field: ({ field, value, onChange }) => {
        return (
          <input
            type="text"
            value={value}
            onChange={(e) => onChange(e.target.value)}
          />
        );
      },
    },
  },
};
  1. Implementing access control:
import { Access } from 'payload/types';

const isAdminOrEditor: Access = ({ req: { user } }) => {
  if (user) {
    return {
      or: [
        {
          'role': {
            equals: 'admin',
          },
        },
        {
          'role': {
            equals: 'editor',
          },
        },
      ],
    };
  }
  return false;
};

Getting Started

  1. Install Payload:
npm install payload
  1. Create a new Payload project:
npx create-payload-app
  1. Start the development server:
npm run dev
  1. Access the admin panel at http://localhost:3000/admin and start building your content structure and API.

Competitor Comparisons

63,346

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.

Pros of Strapi

  • More mature and established project with a larger community and ecosystem
  • Offers a user-friendly admin panel out-of-the-box
  • Provides a marketplace for plugins and extensions

Cons of Strapi

  • Can be resource-intensive and slower for large-scale applications
  • Less flexible for custom backend logic and complex data relationships
  • Steeper learning curve for developers new to the Strapi ecosystem

Code Comparison

Strapi (Content-Type definition):

module.exports = {
  attributes: {
    title: {
      type: 'string',
      required: true,
    },
    content: {
      type: 'richtext',
    },
  },
};

Payload (Collection configuration):

export const Posts = {
  slug: 'posts',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    {
      name: 'content',
      type: 'richText',
    },
  ],
};

Both Strapi and Payload are headless CMS solutions, but they differ in their approach and target audience. Strapi focuses on providing a complete out-of-the-box solution with a user-friendly interface, while Payload emphasizes flexibility and developer experience. The code comparison shows similarities in defining content structures, but Payload's approach is more JavaScript-native and TypeScript-friendly.

27,495

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.

Pros of Directus

  • More mature and established project with a larger community
  • Offers a wider range of features out-of-the-box, including user management and file handling
  • Provides a polished, user-friendly admin interface

Cons of Directus

  • Can be more complex to set up and customize due to its extensive feature set
  • May have a steeper learning curve for developers new to the system
  • Potentially higher resource usage due to its comprehensive nature

Code Comparison

Directus configuration example:

module.exports = {
  database: {
    client: 'pg',
    connection: {
      host: '127.0.0.1',
      port: 5432,
      database: 'directus',
      user: 'directus',
      password: 'directus'
    }
  }
};

Payload configuration example:

export default {
  collections: [
    {
      slug: 'posts',
      fields: [
        {
          name: 'title',
          type: 'text',
          required: true,
        },
      ],
    },
  ],
};

Both Directus and Payload are headless CMS solutions, but they cater to different needs. Directus offers a more comprehensive set of features and a polished admin interface, making it suitable for larger projects with diverse requirements. Payload, on the other hand, provides a more lightweight and flexible approach, allowing for easier customization and integration into existing Node.js applications.

The superpowered headless CMS for Node.js β€” built with GraphQL and React

Pros of Keystone

  • More mature and established project with a larger community and ecosystem
  • Offers a wider range of built-in features and integrations out of the box
  • Provides a powerful GraphQL API with automatic CRUD operations

Cons of Keystone

  • Steeper learning curve due to its extensive feature set
  • Can be more resource-intensive and slower for smaller projects
  • Less flexibility in customizing the admin UI compared to Payload

Code Comparison

Keystone schema definition:

const User = list({
  fields: {
    name: text({ isRequired: true }),
    email: text({ isRequired: true, isUnique: true }),
    password: password(),
  },
});

Payload schema definition:

const User = {
  slug: 'users',
  fields: [
    { name: 'name', type: 'text', required: true },
    { name: 'email', type: 'email', required: true, unique: true },
    { name: 'password', type: 'password' },
  ],
};

Both Keystone and Payload offer similar approaches to defining schemas, with Keystone using a more object-oriented style and Payload using a more declarative structure. Keystone's schema definition is slightly more concise, while Payload's is more explicit in its field types and options.

5,221

Sanity Studio – Rapidly configure content workspaces powered by structured content

Pros of Sanity

  • More mature and established project with a larger community and ecosystem
  • Offers a hosted solution, reducing infrastructure management overhead
  • Provides a powerful query language (GROQ) for flexible content retrieval

Cons of Sanity

  • Pricing can be expensive for larger projects or high-traffic applications
  • Less control over the backend infrastructure due to its hosted nature
  • Steeper learning curve for developers new to its concepts and query language

Code Comparison

Sanity schema definition:

export default {
  name: 'post',
  title: 'Post',
  type: 'document',
  fields: [
    {
      name: 'title',
      title: 'Title',
      type: 'string',
    },
    // ... other fields
  ],
}

Payload collection definition:

const Post = {
  slug: 'posts',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    // ... other fields
  ],
}

Both Sanity and Payload offer flexible content modeling, but Sanity's schema definition is more verbose and includes additional metadata. Payload's collection definition is more concise and straightforward, focusing on essential field properties.

While Sanity provides a powerful hosted solution with advanced querying capabilities, Payload offers more control over the backend and a simpler learning curve. The choice between the two depends on specific project requirements, scalability needs, and developer preferences.

46,780

Independent technology for modern publishing, memberships, subscriptions and newsletters.

Pros of Ghost

  • More mature and established project with a larger community and ecosystem
  • Offers a complete, ready-to-use blogging platform out of the box
  • Includes built-in SEO tools and integrations with popular services

Cons of Ghost

  • Less flexible for custom content types and data structures
  • Steeper learning curve for developers wanting to extend or customize the core functionality
  • Heavier and more opinionated, which may not suit all project requirements

Code Comparison

Ghost (Theme development):

{{#post}}
  <article>
    <h1>{{title}}</h1>
    <div class="content">
      {{content}}
    </div>
  </article>
{{/post}}

Payload (API usage):

const response = await payload.find({
  collection: 'posts',
  where: {
    status: 'published',
  },
  limit: 10,
});

Ghost is a full-featured blogging platform, while Payload is a headless CMS that provides more flexibility for custom content structures. Ghost excels in providing a complete solution for bloggers and publishers, whereas Payload offers greater customization options for developers building complex content-driven applications. The choice between the two depends on the specific needs of the project and the desired level of control over the content management system.

17,877

A Git-based CMS for Static Site Generators

Pros of Decap CMS

  • User-friendly interface for non-technical content editors
  • Supports a wide range of static site generators
  • Easy integration with existing static sites

Cons of Decap CMS

  • Limited customization options for complex data structures
  • Requires external authentication providers for user management
  • Less suitable for dynamic content or complex applications

Code Comparison

Decap CMS (configuration):

backend:
  name: git-gateway
  branch: main
collections:
  - name: "blog"
    label: "Blog"
    folder: "content/blog"
    create: true
    fields:
      - {label: "Title", name: "title", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown"}

Payload CMS (configuration):

const Blog = {
  slug: 'blog',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    {
      name: 'content',
      type: 'richText',
    },
  ],
};

export default Blog;

Decap CMS focuses on simplicity and ease of use for static site content management, while Payload offers more flexibility and power for building complex, dynamic applications. Decap CMS is ideal for small to medium-sized static sites, whereas Payload is better suited for larger, more complex projects requiring custom functionality and advanced data modeling.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Payload headless CMS Admin panel built with React

GitHub Workflow Status Β  Discord Β  npm Β  Payload Twitter


Explore the Docs Â· Community Help Â· Try Live Demo Â· Roadmap Â· View G2 Reviews


[!IMPORTANT] Γ°ΒŸΒŽΒ‰ Payload 3.0 beta released! You can now deploy Payload fully in any Next.js app folder. Read more in the announcement post.

Benefits over a regular CMS

  • DonҀ™t hit some third-party SaaS API, hit your own API
  • Use your own database and own your data
  • It's just Express - do what you want outside of Payload
  • No need to learn how Payload works - if you know JS, you know Payload
  • No vendor lock-in
  • Avoid microservices hell - get everything (even auth) in one place
  • Never touch ancient WP code again
  • Build faster, never hit a roadblock
  • Both admin and backend are 100% extensible

Ҙï¸ Deploy instantly with Payload Cloud.

Create a cloud account, connect your GitHub, and deploy in minutes.

Γ°ΒŸΒšΒ€ Get started by self-hosting completely free, forever.

Before beginning to work with Payload, make sure you have all of the required software.

npx create-payload-app@latest

Alternatively, it only takes about five minutes to create an app from scratch.

Γ°ΒŸΒ–Β±Γ―ΒΈΒ One-click templates

Jumpstart your next project by starting with a pre-made template. These are production-ready, end-to-end solutions designed to get you to market as fast as possible.

Γ°ΒŸΒ›Β’ E-Commerce

Eliminate the need to combine Shopify and a CMS, and instead do it all with Payload + Stripe. Comes with a beautiful, fully functional front-end complete with shopping cart, checkout, orders, and much more.

🌐 Website

Build any kind of website, blog, or portfolio from small to enterprise. Comes with a beautiful, fully functional front-end complete with posts, projects, comments, and much more.

We're constantly adding more templates to our Templates Directory. If you maintain your own template, consider adding the payload-template topic to your GitHub repository for others to find.

Ҝ¨ Features

Request Feature

Γ°ΒŸΒ—Β’Γ―ΒΈΒ Documentation

Check out the Payload website to find in-depth documentation for everything that Payload offers.

Migrating from v1 to v2? Check out the 2.0 Release Notes on how to do it.

Γ°ΒŸΒ™Β‹ Contributing

If you want to add contributions to this repository, please follow the instructions in contributing.md.

Γ°ΒŸΒ“Βš Examples

The Examples Directory is a great resource for learning how to setup Payload in a variety of different ways, but you can also find great examples in our blog and throughout our social media.

Γ°ΒŸΒ”ΒŒ Plugins

Payload is highly extensible and allows you to install or distribute plugins that add or remove functionality. There are both officially-supported and community-supported plugins available. If you maintain your own plugin, consider adding the payload-plugin topic to your GitHub repository for others to find.

🚨 Need help?

There are lots of good conversations and resources in our Github Discussions board and our Discord Server. If you're struggling with something, chances are, someone's already solved what you're up against. :point_down:

Ò­ Like what we're doing? Give us a star

payload-github-star

Γ°ΒŸΒ‘Β Thanks to all our contributors