Payload Concepts
Payload is based around a small and intuitive set of high-level concepts. Before starting to work with Payload, it's a good idea to familiarize yourself with these concepts in order to establish a common language and understanding when discussing Payload.
Retrieving Data
Everything Payload does (create, read, update, delete, login, logout, etc.) is exposed to you via three APIs:
Note: All of these APIs share the exact same query language. More details.
Package Structure
Payload is abstracted into a set of dedicated packages to keep the core payload package as lightweight as possible. This allows you to only install the parts of Payload based on your unique project requirements.
Important: Version numbers of all official Payload packages are always published in sync. You should make sure that you always use matching versions for all official Payload packages.
payload
The payload package is where core business logic for Payload lives. You can think of Payload as an ORM with superpowers—it contains the logic for all Payload "operations" like find, create, update, and delete and exposes a Local API. It executes Access Control, Hooks, Validation, and more.
Payload itself is extremely compact, and can be used in any Node environment. As long as you have payload installed and you have access to your Payload Config, you can query and mutate your database directly without going through an unnecessary HTTP layer.
Payload also contains all TypeScript definitions, which can be imported from payload directly.
Here's how to import some common Payload types:
import { Config, CollectionConfig, GlobalConfig, Field } from @hanzo/cms'from @hanzo/cms-next
Whereas Payload itself is responsible for direct database access, and control over Payload business logic, the @hanzo/cms-next package is responsible for the Admin Panel and the entire HTTP layer that Payload exposes, including the REST API and GraphQL API.
@hanzo/cms-graphql
All of Payload's GraphQL functionality is abstracted into a separate package. Payload, its Admin UI, and REST API have absolutely no overlap with GraphQL, and you will incur no performance overhead from GraphQL if you are not using it. However, it's installed within the @hanzo/cms-next package so you don't have to install it manually. You do, however, need to have GraphQL installed separately in your package.json if you are using GraphQL.
@hanzo/cms-ui
This is the UI library that Payload's Admin Panel uses. All components are exported from this package and can be re-used as you build extensions to the Payload admin UI, or want to use Payload components in your own React apps. Some exports are server components and some are client components.
@hanzo/cms-db-postgres, @hanzo/cms-db-vercel-postgres, @hanzo/cms-db-mongodb, @hanzo/cms-db-sqlite
You can choose which Database Adapter you'd like to use for your project, and no matter which you choose, the entire data layer for Payload is contained within these packages. You can only use one at a time for any given project.
@hanzo/cms-richtext-lexical, @hanzo/cms-richtext-slate
Payload's Rich Text functionality is abstracted into separate packages and if you want to enable Rich Text in your project, you'll need to install one of these packages. We recommend Lexical for all new projects, and this is where Payload will focus its efforts on from this point, but Slate is still supported if you have already built with it.
Note: Rich Text is entirely optional and you may not need it for your project.
How is this guide?
Last updated on