A Payload site, ready to clone

Collection generator

A new content type with its pages, written by one command instead of by hand.

What it does

A project often needs content of its own: rooms, offers, team members, testimonials. pnpm make:collection writes it in one go: the collection with its fields, its admin texts in the project’s languages, the templates of its pages and their CSS, and the lines that register them in the project. It writes only in the project’s own folder, so the next template update keeps it, and the same command always writes the same files.

The options cover what such content usually needs. A collection can have a page per document and a listing, or only the listing, or no public pages at all (testimonials shown by a block). Its base path and its listing’s title can differ per language (/rooms, /es/habitaciones), and the listing splits into pages. It can have fields of its own: text, rich text, numbers, dates, yes or no, images and files, a choice from a list, a link to another document, a link to an address, or a link editors point at a page, a post or a typed address (it follows the page when its URL changes), each translatable or not. Another field can be its title (a testimonial titled by its author), and its documents can have the same blocks as pages.

It checks before writing: a name, a path or a field already taken, a project that doesn’t start, or migrations that aren’t up to date stop it with nothing written. Afterwards it type-checks the project and runs the start-up checks.

See it in the demo

This is a tool for whoever builds the site, so there is nothing to click here. In a project, run pnpm make:collection --help for every option, or add --dry-run to see the files it would write. The README section "Generators" walks through a whole example.

For whoever works with Claude Code, the apex-make-collection skill drives the generator: describe the collection in your own words, answer one round of questions, check the plan, and it generates the collection and runs the migration steps. It never writes by hand what the generator writes.

For developers

The generator is scripts/make-collection.ts, with its logic in src/lib/generators/ (pure and tested). It edits project/project.config.ts and project/project.components.ts through TypeScript’s syntax tree, so comments and layout stay. A file it wrote carries a mark with a fingerprint: --force rewrites it only while it is untouched. Then come pnpm migrate:create <name> and pnpm migrate, as for any change to the schema. The skill is in .claude/skills/apex-make-collection/, and a test checks it names every option the generator has.

One block, every feature page

This strip is a reusable block: written once and placed at the end of every feature page. Edit it under Reusable blocks and all of them change.

All features