◐ Shell
clean mode source ↗

The best way to build a modern, Next.js backend | Payload

Define your schema in code and get a full TypeScript backend and admin panel. Instantly.

Skip the hassle of building your own admin panel or using an ORM. With Payload, access a comprehensive, open-source solution that includes built-in authentication, access control, and more, all without the need for additional frameworks or tools.

Payload is Next.js native

Payload is built on Next.js, ensuring less hassle, more speed, and enhancing your projects from the ground up.

Fully Leverage React Server Components

Extend your admin panel with server components, reducing client-side load and keeping business logic behind the scenes.

Turbopack Out of Box

Payload supports Turbopack from the start, accelerating development with instant updates and a superior developer experience.

Deploy Serverlessly

A Next.js foundation allows effortless deploy of your full stack to serverless platforms like Vercel, streamlining your workflow and boosting scalability.

Harmonious Front and Back-End Deployment

Bring your front and back-end together in perfect harmony, simplifying deployment and enhancing collaboration across your entire stack.

This elevates the Headless CMS experience to a new level.

01

Unapologetically code-first

Central to its functionality, the Payload config efficiently scaffolds data storage, custom React components, hook logic, and more, all with the added benefit of TypeScript's strong typing for unmatched productivity.

Simple example of Payload config

1

import { buildConfig } from 'payload/config'

2

import { mongooseAdapter } from '@payloadcms/db-mongodb'

4

import { viteBundler } from '@payloadcms/bundler-vite'

6

import { lexicalEditor } from '@payloadcms/richtext-lexical'

8

export default buildConfig({

10

bundler: webpackBundler(), // Choose your bundler

12

db: mongooseAdapter({}) // Choose your database

13

editor: lexicalEditor({}) // Choose your rich text editor

15

// Define your collections

18

// Define your globals

02

Local API

Payload's Local API lets you directly interact with your database on-server, bypassing third-party server latency for instant data access—transforming speed and efficiency in your apps.

1

// The created Post document is returned

2

const post = await payload.create({

3

collection: 'posts', // required

10

fallbackLocale: false,

13

showHiddenFields: false,

15

// If creating verification-enabled auth doc,

16

// you can optionally disable the email that is auto-sent

17

disableVerificationEmail: true,

19

// If your collection supports uploads, you can upload

20

// a file directly through the Local API by providing

21

// its full, absolute file path.

22

filePath: path.resolve(__dirname, './path-to-image.jpg'),

24

// Alternatively, you can directly pass a File,

25

// if file is provided, filePath will be omitted

03

Simplified Authentication

Payload offers out-of-the-box, customizable user authentication, ensuring secure identity verification both in the Admin panel and across your apps as needed.

Simple example of Payload Auth

1

import { CollectionConfig } from 'payload/types'

3

export const Admins: CollectionConfig = {

6

tokenExpiration: 7200, // How many seconds to keep the user logged in

7

verify: true, // Require email verification before being allowed to authenticate

8

maxLoginAttempts: 5, // Automatically lock a user out after X amount of failed logins

9

lockTime: 600 * 1000, // Time period to allow the max login attempts

10

// More options are available

Features & extensibility designed so you’ll never hit a roadblock.

11

Custom endpoints

Add your own endpoints for custom functionality.

No black magic. Just code the way it’s meant to be.

Magic should come not from obscuring the hard parts, but instead, watching the code you write become a project you’re proud of. Payload is built on transparency, offering you full control with the safety net of conventions and best practices.

To say another way, if you ever have to “learn” Payload, we’ve failed. There are no closed doors here, only open paths to explore and innovate.

If we've done our job, Payload will make you a better developer.

Payload provides solutions, not roadblocks.

Forever free and fully open-source under the MIT License.