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 boilerplate <command>Available Commands
Section titled “Available Commands”collection
Section titled “collection”Scaffolds a new PayloadCMS collection with sensible defaults.
ddev boilerplate collection [options]Options:
--name=<name>— Collection name, plural, in kebab-case (e.g.,blog-posts)--type=<type>— Collection type:publicorprivate
Missing options are asked for interactively.
Example:
# Interactive promptddev boilerplate collection
# With optionsddev boilerplate collection --name=blog-posts --type=publicWhat it creates:
src/collections/[name].ts, built withpublicCollection()orprivateCollection()
The factory provides the defaults, such as access control and versioning. Public collections also get SEO fields and revalidation hooks.
After running:
- Add the collection to
payload.config.ts - For public collections, register the route in
src/lib/url/slug.ts - Add to
src/app/(frontend)/sitemap.ts - Run
ddev pnpm generate:types - Create the frontend route in
src/app/(frontend)/[name]/
global
Section titled “global”Scaffolds a new PayloadCMS global.
ddev boilerplate global [options]Options:
--name=<name>— Global name, singular, in kebab-case (e.g.,site-settings)
Example:
# Interactive promptddev boilerplate global
# With optionddev boilerplate global --name=site-settingsWhat it creates:
src/globals/[name].ts, built withsiteGlobal()
After running:
Add the global to payload.config.ts and run ddev pnpm generate:types.
Scaffolds a new content block with config and component files.
ddev boilerplate block [options]Options:
--name=<name>— Block name in kebab-case (e.g.,hero-banner)
Example:
# Interactive promptddev boilerplate block
# With optionddev boilerplate block --name=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
src/blocks/render-blocks.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 boilerplate feature add <name>ddev boilerplate feature remove <name>ddev boilerplate feature listExample:
ddev boilerplate 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 |
Check with Biome and Stylelint |
ddev pnpm lint:fix |
Fix with Biome and Stylelint |
ddev pnpm typecheck |
Type-check with tsc |
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 |