nextjs-cms

Open source · Next.js 16 · MySQL

The CMS you define in TypeScript.

Describe your content as section files. nextjs-cms turns them into a complete admin panel, real MySQL tables, and a typed API — inside your own Next.js app.

Terminal
pnpm create nextjs-cms@latest my-cms
sections/posts.section.ts
import { hasItemsSection } from 'nextjs-cms/core/sections'
import { photoField, richTextField, slugField, textField } from 'nextjs-cms/core/fields'

const title = textField({ name: 'title', required: true })

export default hasItemsSection({
    name: 'posts',
    order: 1,
    title: { section: 'Blog', singular: 'Post', plural: 'Posts' },
    headingField: title,
    db: { table: 'posts' },
    fields: [
        title,
        slugField({ name: 'slug', for: title }),
        photoField({
            name: 'cover',
            thumbnail: { width: 400, height: 300, fit: 'cover' },
        }),
        richTextField({ name: 'body', allowMedia: true }),
    ],
})

Everything a content team needs

One section file gives you the form, validation, storage, permissions and API. No schema files to keep in sync, no separate backend to host.

17 field types

Text, rich text, slugs, numbers, dates, selects, tags, maps, photos, videos, documents and more.

Schema from code

update-sections diffs your section files against MySQL and creates, alters or renames tables for you.

Three section types

Singletons for settings, collections for posts and products, trees for nested categories.

Content localization

Mark a field localized and translations live in a per-section _locales table, RTL included.

Image pipeline

Resizing, thumbnails, watermarks and galleries powered by sharp, configured per field.

Per-section permissions

Grant admins create, update, delete and publish rights section by section.

Auth built in

JWT sessions with refresh tokens and CSRF protection, no third-party service required.

Plugins

Add dashboards, analytics and tools as npm packages with their own routes and tRPC routers.

Using nextjs-cms

Install, configure, and build sections and fields. Every option comes with a minimal and a complete example.

Read the docs

Contributing

How the core works: config and section loading, the field system, the submit pipeline, schema sync, and how to add your own field type.

Explore the internals