sample-template, and understanding how variables and steps work in practice.
Install the CLI
Install Projgen globally so theprojgen command is available everywhere:
npx:
Projgen requires Node.js >= 18. Run
node -v to check your version.Run your first template
The official Projgen/templates repository contains ready-to-use templates. The simplest one issample-template — it prompts for a name and echoes a greeting. That’s it. It’s intentionally minimal so you can see the full lifecycle without noise.
Run the sample template
Point Aliases
projgen create at the raw template URL:c and cr work identically:Allow remote template execution
Because the template comes from an external URL, Projgen asks you to confirm before doing anything:Type
y and press Enter to continue.Answer the prompt
Projgen validates the template, then prompts you for every declared variable before any steps run:Type your name and press Enter.
What just happened
Here is the complete source of the sample template so you can see exactly what ran:variablesdeclares onestringprompt. Becauserequired: true, Projgen will always ask for it —-ycannot skip it (see below).stepsdeclares onerunstep. Theargsarray contains"Hello {{name}}"— Projgen replaces{{name}}with whatever you typed before the command runs.
Add a template to your local registry
Instead of passing a file path or URL every time, register the template under an alias:template.id as the alias (sample-template in this case). The registry will reject a projgen add call if either the alias or the id is already registered — templates are stored by id filename, so duplicates are not allowed.
Run
projgen list (alias: projgen ls) at any time to see all registered
templates, the registry version, and any linked registries.Skipping prompts with -y
Add -y to skip any variable prompt that is either optional (required: false) or has a default value. Projgen will use the default or leave the value empty without asking.
required: true with no default are always prompted, even with -y. There is no way to suppress a required variable without a default — Projgen needs a value to proceed.
| Variable config | Behaviour with -y |
|---|---|
required: true, no default | Always prompted — cannot be skipped |
required: true, has default | Skipped — default value used |
required: false, no default | Skipped — value is empty / null |
required: false, has default | Skipped — default value used |
name is required: true with no default, so -y has no effect — you will still be asked for it.
What’s next
Introduction
Understand how the CLI, Template Engine, and registry fit together.
CLI commands
Full reference for
create, add, list, and remove.Template spec
All variable types, step types, and condition operators.
Official templates
Browse production-ready templates from the Projgen team.