Skip to main content
This guide walks you through installing the CLI, running the official sample-template, and understanding how variables and steps work in practice.

Install the CLI

Install Projgen globally so the projgen command is available everywhere:
You can also run any template directly without a global install using 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 is sample-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.
1

Run the sample template

Point projgen create at the raw template URL:
Aliases c and cr work identically:
2

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.
Only run templates from sources you trust. A template can execute shell commands and write files on your machine.
3

Answer the prompt

Projgen validates the template, then prompts you for every declared variable before any steps run:
Type your name and press Enter.
4

Watch the step execute

After all variables are collected, Projgen runs the steps in order. The sample template has a single run step:

What just happened

Here is the complete source of the sample template so you can see exactly what ran:
Two things to notice:
  • variables declares one string prompt. Because required: true, Projgen will always ask for it — -y cannot skip it (see below).
  • steps declares one run step. The args array contains "Hello {{name}}" — Projgen replaces {{name}} with whatever you typed before the command runs.
{{ variableName }} interpolation works anywhere a string appears inside a step — in command, args, path, content, cwd, url, or value. The substitution happens at execution time, after all prompts are answered.

Add a template to your local registry

Instead of passing a file path or URL every time, register the template under an alias:
Now run it by alias from anywhere:
If you omit the alias, Projgen uses 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.
Variables that are 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. In the sample template, 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.