Payload CMS is a headless CMS built on Next.js. TypeScript-native, self-hosted, with auto-generated APIs and a beautiful admin panel.
Quick Start
npx create-payload-app@latest
Define Collections
// collections/Posts.ts
import { CollectionConfig } from 'payload'
export const Posts: CollectionConfig = {
slug: 'posts',
admin: { useAsTitle: 'title' },
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'content', type: 'richText' },
{ name: 'author', type: 'relationship', relationTo: 'users' },
{ name: 'status', type: 'select', options: ['draft', 'published'] },
{ name: 'publishDate', type: 'date' },
{ name: 'featuredImage', type: 'upload', relationTo: 'media' }
]
}
This generates:
- REST API:
GET /api/posts,POST /api/posts, etc. - GraphQL API: queries and mutations
- Admin panel: CRUD interface with rich text editor
Access Control
export const Posts: CollectionConfig = {
access: {
read: () => true, // anyone can read
create: ({ req }) => !!req.user, // must be logged in
update: ({ req }) => req.user?.role === 'admin',
delete: ({ req }) => req.user?.role === 'admin',
},
// ...
}
Payload vs Strapi vs Sanity
| Feature | Payload | Strapi | Sanity |
|---|---|---|---|
| Language | TypeScript | JavaScript | Proprietary |
| Framework | Next.js | Koa | N/A |
| Self-hosted | Yes | Yes | Cloud only |
| Admin UI | Built-in | Built-in | Studio |
| API | REST + GraphQL | REST + GraphQL | GROQ |
| License | MIT | MIT | Proprietary |
The Bottom Line
Payload is the CMS for Next.js developers. TypeScript-native, self-hosted, with the best admin UI in the open-source CMS space.
Need to automate data collection or build custom scrapers? Check out my Apify actors for ready-made tools, or email spinov001@gmail.com for custom solutions.
Top comments (0)