⚠️ Work in progress — createCMS is pre-1.0 and not production-ready (not tested in production). Expect breaking changes.
createCMS
Reference

CLI

The createcms command-line interface.

@createcms/core ships one CLI binary, createcms, with two subcommands: init (scaffold a project) and generate (write the Drizzle schema). Run them with npx (or your runner of choice):

npx createcms --help

createcms init

Scaffolds a CMS config, a collection preset, and a Next.js route handler into your project, and adds a cms:generate script to package.json.

npx createcms init [--cwd <dir>] [--preset <name>]
FlagTypeDefaultDescription
--cwdpathcurrent directoryProject root to scaffold into.
--presetnameCollection preset to scaffold.

createcms generate

Generates a Drizzle schema from your CMS config (core tables plus any plugin schema). The schema is content-agnostic, so you re-run it only when you add or change a plugin that ships schema, not when you edit a collection.

npx createcms generate [config] [--output <path>]
Argument / flagTypeDefaultDescription
configpathauto-discoveredPath to your CMS config file.
--outputpath./cms-schema.tsWhere to write the generated schema.
--checkflagVerify the on-disk schema matches your config without writing. Exits non-zero on drift. Use in CI.

When config is omitted, the CLI searches these paths in order and uses the first that exists:

cms.ts, cms.js, src/cms.ts, src/cms.js, src/lib/cms.ts, src/lib/cms.js, lib/cms.ts, lib/cms.js

The output path falls back to the config's schema.output when set, otherwise ./cms-schema.ts. If the output file already exists, the CLI asks before overwriting. Loading your config does not open a database connection or contact S3: the CLI stubs every installed package, so a run only confirms the config file loads and the schema emits.

npx createcms generate
#   config   /app/src/lib/cms.ts
#   output   /app/cms-schema.ts
#   plugins  abTest, multi-tenant
#   ✓ Schema generated
#   file     /app/cms-schema.ts
#   tables   18
#   enums    4

After generating, apply the schema with your Drizzle migration workflow. The drizzle-kit commands read a drizzle.config.ts at your project root — see the Quickstart for the one to create:

npx drizzle-kit generate && npx drizzle-kit migrate

Guard against a stale schema in CI

Fail the build if the committed schema drifted from your config:

npx createcms generate --check

It reruns the generator in memory and compares the result to your committed schema file — no database or server needed. Exit code 0 when they match, non-zero (with a diff hint) when they don't.

Re-run createcms generate after adding or changing a plugin that contributes schema, not when you edit a collection.

On this page