Payload 3.x Documentation
website·Indexed 39 days ago
https://payloadcms.com/docsOfficial documentation for Payload 3.x, an open-source Next.js fullstack framework and headless CMS. Covers core concepts, installation, and a code-first API for configuring collections, globals, and fields. Includes detailed guides on database integration for MongoDB, Postgres, and SQLite, as well as migration controls, transactions, and localization.
What's inside Payload
- Payload provides a built-in system to store user-specific preferences persistently across sessions and devices. This is used internally by the Admin Panel to track things like column order in Collection List Views, the last active Locale, and the collapsed state of fields (blocks, array, collapsible). All preferences are stored on an individual user basis, and Payload automatically identifies the user via authentication.
Overview of Custom Components in Payload
Payload allows you to replace default Admin Panel UI elements with your own React components via the Payload Config. By default, all custom components are React Server Components (RSC), allowing direct use of the Local API on the front-end. To create a Client Component, add the
'use client'directive at the top of the file. Payload automatically removes non-serializable default props before rendering Client Components.There are four primary scopes for custom components:
- Root Components
- Collection Components
- Global Components
- Field Components
Overview of Payload Access Control
Access Control in Payload determines user permissions for Documents and visibility within the Admin Panel. It is scoped to specific operations (create,read,update,delete) and executes before any changes are made or operations are completed. Access Control can be implemented at three levels: Collection, Global, and Field.Overview of PayloadCMS MCP Plugin
The MCP Plugin adds Model Context Protocol (MCP) capabilities to PayloadCMS, allowing AI models to interact with your CMS. Key features include the ability to allow or disallowfind,create,update, anddeleteoperations for specific collections, andfindandupdateoperations for globals. It also enables the definition of custom Prompts, Tools, and Resources available over the MCP protocol.Overview of Lexical Rich Text Views
Views allow you to define shared rendering logic for Lexical nodes that works in both the admin panel and JSX converters. This enables editors to switch between different visual modes (like a 'preview' mode) within the admin panel to see how content will appear on the site. Views can override node rendering, admin UI configuration, and Lexical editor settings without changing the underlying data structure. Note: This feature is currently experimental.Overview of the Payload Search Plugin
The Search Plugin generates a dedicatedsearchcollection in the database that stores static copies of search-critical data from your other collections. This allows for extremely fast searching and querying using standard Payload APIs while bypassing any hooks present on the original documents. It is designed as a first-party alternative to third-party services like Algolia or ElasticSearch.Overview of Payload Rich Text Features
Payload provides a set of built-in Rich Text features to handle formatting, structural elements, and editor tooling. Most features are included by default, while some (like FixedToolbarFeature, BlocksFeature, and TreeViewFeature) must be explicitly enabled. All features are customizable, and users can create their own custom features.Overview of Folders in Payload CMS
Folders allow you to group documents across different collections to organize content. Technically, Folders are implemented using relationship fields. When enabled on a collection, Payload adds a hidden relationship field namedfolders(or a custom name defined in the global config) that links the document to a folder. Folders support nesting via their ownfolderfield.Overview of the Payload Redirects Plugin
The Redirects Plugin provides a way to manage application redirects within the Payload Admin Panel. It adds aredirectscollection to the CMS configuration, allowing users to specify a 'from' URL and a 'to' URL. This is primarily used for SEO and maintaining search engine rankings during re-platforming or URL structure changes. Note that the plugin only manages the data in the database; the actual HTTP redirect logic must be implemented in the front-end application (e.g., Next.js or Express) by querying theredirectscollection.Overview of the Payload Local API
The Payload Local API allows developers to execute the same operations available via REST and GraphQL directly within a Node.js server environment. This eliminates network latency and HTTP overhead, making it ideal for React Server Components, data seeding scripts, custom Next.js route handlers, and within Payload's own Access Control and Hooks systems.Overview of the Payload Multi-Tenant Plugin
The Multi-Tenant Plugin allows you to set up multi-tenancy within the Payload Admin Panel. It automatically adds a
tenantfield to specified collections, enabling the front-end to query data by tenant. Key features include:- A tenant selector in the admin panel to switch between tenants.
- Automatic filtering of list views and relationship fields by the selected tenant.
- Support for 'global' collections (one document per tenant).
- Automatic tenant assignment for new documents.
- Write enforcement to prevent users from assigning documents to tenants they are not members of.
- Automatic cleanup of related documents when a tenant is deleted (can be disabled).
Overview of Payload authentication strategies
Payload provides three built-in authentication strategies that can work independently or together, as well as the ability to create custom strategies:
- HTTP-Only Cookies: Highly secure storage for identifiable data; protected from XSS attacks and inaccessible to browser JavaScript.
- JSON Web Tokens (JWT): Tokens generated during
login,refresh, andmeoperations, which are attached to requests for authentication. - API Keys: Enabled on auth collections, primarily used for authenticating third-party services against Payload.