Payload CMS is the open-source headless CMS that gives you a full REST and GraphQL API out of the box — with TypeScript, authentication, access control, and file uploads built in.
What Is Payload CMS?
Payload is a TypeScript-first headless CMS built on top of Express and MongoDB/PostgreSQL. Unlike WordPress, everything is code-defined — your content schema IS your TypeScript code.
The API
Every collection you define automatically gets REST and GraphQL endpoints.
Define a Collection
// collections/Posts.ts
import { CollectionConfig } from 'payload/types'
const Posts: CollectionConfig = {
slug: 'posts',
access: {
read: () => true,
create: ({ req: { user } }) => Boolean(user),
},
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'content', type: 'richText' },
{ name: 'author', type: 'relationship', relationTo: 'users' },
{ name: 'publishedAt', type: 'date' },
{ name: 'tags', type: 'array', fields: [{ name: 'tag', type: 'text' }] },
],
}
export default Posts
REST API (auto-generated)
# Get all posts
curl https://your-app.com/api/posts
# Get single post
curl https://your-app.com/api/posts/POST_ID
# Create post (authenticated)
curl -X POST https://your-app.com/api/posts \
-H 'Authorization: JWT your-token' \
-H 'Content-Type: application/json' \
-d '{"title": "My Post", "content": [{"type": "paragraph", "children": [{"text": "Hello"}]}]}'
# Query with filters
curl 'https://your-app.com/api/posts?where[tags][contains]=javascript&sort=-publishedAt&limit=10'
GraphQL API
query {
Posts(where: { tags: { contains: "javascript" } }, sort: "-publishedAt", limit: 10) {
docs {
id
title
author { name email }
publishedAt
}
totalDocs
totalPages
}
}
Why Payload Over WordPress?
| Feature | Payload CMS | WordPress |
|---|---|---|
| Type safety | Full TypeScript | None |
| API | REST + GraphQL | REST (plugin) |
| Auth | Built-in JWT | Plugin |
| Database | MongoDB/Postgres | MySQL only |
| Admin UI | Auto-generated | Manual |
| Self-hosted | Yes | Yes |
| Performance | Fast (Node.js) | Slow (PHP) |
Real Use Case: Blog with Auth
import payload from 'payload'
// Login
const { token } = await payload.login({
collection: 'users',
data: { email: 'admin@example.com', password: 'secret' },
})
// Create post
const post = await payload.create({
collection: 'posts',
data: {
title: 'Payload CMS is Amazing',
content: [{ type: 'paragraph', children: [{ text: 'Built with TypeScript!' }] }],
publishedAt: new Date().toISOString(),
},
})
console.log(`Created: ${post.id}`)
Getting Started
npx create-payload-app@latest my-app
cd my-app && npm run dev
Your API is live at http://localhost:3000/api. Admin panel at /admin.
Need web scraping at scale? Scrapfly handles proxies, headless browsers, and anti-bot for you. Email spinov001@gmail.com for custom solutions.
Top comments (0)