CLI
The boilerplate includes a CLI for scaffolding collections, globals, and blocks. All commands run through DDEV to keep environments consistent. Access it via DDEV:
ddev pnpm cli <command>Available Commands
Section titled “Available Commands”scaffold collection
Section titled “scaffold collection”Scaffolds a new PayloadCMS collection with sensible defaults.
ddev pnpm cli scaffold collection <name> [options]Arguments:
name— Collection name in kebab-case (e.g.,blog-posts)
Options:
--type <type>— Collection type:publicorprivate(default:public)
Example:
# Interactive promptddev pnpm cli scaffold collection
# With argumentsddev pnpm cli scaffold collection blog-posts --type publicWhat it creates:
src/collections/[name].tswith full configuration- SEO fields (meta title, description, image)
- Access control defaults
- Revalidation hooks
- Version tracking
After running:
- Add the collection to
payload.config.ts - Add to
src/lib/url/slug.tsfor SEO - Add to
src/app/(frontend)/sitemap.ts - Run
ddev pnpm generate:types - Create the frontend route in
src/app/(frontend)/[name]/
scaffold global
Section titled “scaffold global”Scaffolds a new PayloadCMS global.
ddev pnpm cli scaffold global <name>Arguments:
name— Global name in kebab-case (e.g.,site-settings)
Example:
# Interactive promptddev pnpm cli scaffold global
# With argumentddev pnpm cli scaffold global site-settingsWhat it creates:
src/globals/[name].tswith full configuration
After running:
Add the global to payload.config.ts and run ddev pnpm generate:types.
scaffold block
Section titled “scaffold block”Scaffolds a new content block with config and component files.
ddev pnpm cli scaffold block <name>Arguments:
name— Block name in kebab-case (e.g.,hero-banner)
Example:
# Interactive promptddev pnpm cli scaffold block
# With argumentddev pnpm cli scaffold block hero-bannerWhat it creates:
src/blocks/[name]/config.ts— Block configurationsrc/blocks/[name]/[name]-block.tsx— React componentsrc/blocks/[name]/[name].scss— Styles
After running:
- Register the block in
RenderBlocks.tsx - Add the block to a collection’s
blocksarray
feature
Section titled “feature”Adds or removes optional boilerplate features. Features ship outside the lean base and are installed on demand — forms is the first.
ddev pnpm cli feature add <name>ddev pnpm cli feature remove <name>ddev pnpm cli feature listExample:
ddev pnpm cli feature add formsWhat add forms does:
- Copies the form renderer into
src/components/form/and the plugin config intosrc/plugins/ - Adds the
@payloadcms/plugin-form-builder,react-hook-form, and@hookform/resolversdependencies - Registers the plugin in
src/plugins/plugins.ts
After running:
ddev pnpm installddev pnpm generate:types- Create a migration:
ddev pnpm payload migrate:create
See the Forms guide for details.
Project Scripts
Section titled “Project Scripts”Beyond the custom CLI, these scripts are available:
| Command | Purpose |
|---|---|
ddev pnpm dev | Start development server |
ddev pnpm build | Build for production |
ddev pnpm lint | Run Biome and Stylelint |
ddev pnpm format | Auto-format code |
ddev pnpm test | Run tests |
ddev pnpm generate:types | Generate PayloadCMS types |
ddev pnpm payload migrate | Run database migrations |
ddev pnpm payload migrate:status | Check migration status |