Skip to content

Overview

Boilerplate is a standalone CLI tool for generating files and folders from customizable templates. It reads a configuration file (boilerplate.yml), prompts for variable values (or reads them from CLI flags and files), and renders Go templates into an output directory.

  • Scaffolding new projects — Generate an entire project structure from a template with variables for names, configurations, and options.
  • Generating configuration files — Create environment-specific config files by filling in variables like hostnames, ports, and feature flags.
  • Embedding code in documentation — Use the snippet helper to include code from source files, keeping examples always up-to-date.
  • Automating repetitive tasks — Run Boilerplate in CI/CD pipelines with --non-interactive mode to automate file generation.
  1. You create a template directory containing template files and a boilerplate.yml configuration file.
  2. You run boilerplate --template-url <template> --output-folder <output>.
  3. Boilerplate reads the config, prompts for (or accepts) variable values, and renders all template files into the output folder.
my-template/
├── boilerplate.yml # Configuration: variables, dependencies, hooks
├── README.md # Template file with {{.Variables}}
├── main.go # Another template file
└── configs/
└── app.yml # Nested templates work too
ConceptDescription
TemplateA directory of files with Go template syntax and a boilerplate.yml
VariableA named value (string, int, bool, list, map, enum) provided by the user
DependencyAnother template that runs as part of the current template
HookA shell command that runs before or after template rendering
PartialA reusable template fragment that can be included in multiple files

By default, Boilerplate runs in interactive mode, prompting the user for each variable value. For automation and CI/CD, use --non-interactive mode where all variables must be provided via --var flags or --var-file files.