DEV Community

Alex Spinov
Alex Spinov

Posted on

Payload CMS 3 Has a Free API — Next.js-Native Headless CMS with Code-First Config

What if your CMS lived inside your Next.js app — same repo, same deployment, same database, zero external services?

Payload CMS 3 is a headless CMS that runs as a Next.js plugin. Your admin panel and API are part of your application.

Why Payload 3

  • Next.js native — runs inside your Next.js app, not a separate service
  • Code-first — define collections in TypeScript, not a GUI
  • Auto-generated API — REST and GraphQL out of the box
  • Type-safe — TypeScript types generated from your config
  • Any database — Postgres, MongoDB, SQLite via adapters
  • Self-hosted — no vendor lock-in, deploy anywhere
  • Free & open source — MIT licensed

Quick Start

npx create-payload-app@latest
Enter fullscreen mode Exit fullscreen mode
// payload.config.ts
import { buildConfig } from "payload/config";

export default buildConfig({
  collections: [
    {
      slug: "posts",
      fields: [
        { name: "title", type: "text", required: true },
        { name: "content", type: "richText" },
        { name: "author", type: "relationship", relationTo: "users" },
        { name: "publishedAt", type: "date" },
        { name: "status", type: "select", options: ["draft", "published"] },
      ],
    },
  ],
});
Enter fullscreen mode Exit fullscreen mode

That gives you:

  • Admin panel at /admin
  • REST API at /api/posts
  • GraphQL at /api/graphql
  • Auto-generated TypeScript types

Use in Your Next.js Pages

import { getPayload } from "payload";

export default async function BlogPage() {
  const payload = await getPayload({ config });

  const posts = await payload.find({
    collection: "posts",
    where: { status: { equals: "published" } },
    sort: "-publishedAt",
  });

  return posts.docs.map(post => (
    <article key={post.id}>
      <h2>{post.title}</h2>
    </article>
  ));
}
Enter fullscreen mode Exit fullscreen mode

Real Use Case

A marketing team used Contentful ($400/month) for their Next.js site. After migrating to Payload 3, the CMS became part of their codebase — same Vercel deployment, same Postgres database. They saved $4,800/year and gained full control over the admin UI.

When to Use Payload

  • Next.js apps needing a CMS
  • Teams wanting code-first content modeling
  • Projects requiring self-hosted CMS
  • Any use case where Contentful/Sanity feels expensive or limiting

Get Started

Visit payloadcms.com — open source, MIT licensed, free forever.


Need custom data pipelines or scraping solutions? Check out my Apify actors or email me at spinov001@gmail.com for custom solutions.

Top comments (0)