---
title: Boilerplate
description: A code generation tool by Gruntwork for scaffolding projects and configs from templates.
template: splash
editUrl: false
hero:
  title: |
    The template generator <span class="hero-accent">built for platform teams</span>
  tagline: |
    Boilerplate is an open source template generator by <a href="https://gruntwork.io">Gruntwork</a>. Define your _boilerplate_ once, then generate code repeatedly with a single command.
  image:
    html: |
      <div class="hero-logo-container">
        <img src="/favicon.svg" alt="" class="hero-logo-img" />
      </div>
  actions:
    - text: Get Started
      link: /intro/overview/
      icon: right-arrow
      variant: primary
    - text: View on GitHub
      link: https://github.com/gruntwork-io/boilerplate
      icon: external
      variant: minimal
---

import { Card, CardGrid, Tabs, TabItem } from '@astrojs/starlight/components';
import LandingSection from '../../components/LandingSection.astro';
import CompactCards from '../../components/CompactCards.astro';
import SecondaryFeatures from '../../components/SecondaryFeatures.astro';

<LandingSection>

## How it works

Define a `boilerplate.yml` with your variables, write Go-template files, and run one command.
Boilerplate handles prompts, defaults, validation, and rendering.

<Tabs>
  <TabItem label="1. Define variables">
```yaml
# boilerplate.yml
variables:
  - name: ProjectName
    description: The name of your project
    type: string

  - name: EnableDocker
    description: Include Docker configuration?
    type: bool
    default: true
```
  </TabItem>
  <TabItem label="2. Write templates">
```text title="README.md"
# {{.ProjectName}}

Welcome to {{.ProjectName}}!

{{if .EnableDocker}}
## Docker

Run with: `docker compose up`
{{end}}
```
  </TabItem>
  <TabItem label="3. Generate">
```bash
boilerplate \
  --template-url ./my-template \
  --output-folder ./my-project \
  --var ProjectName="My App"
```
  </TabItem>
  <TabItem label="4. Output">
```markdown title="my-project/README.md"
# My App

Welcome to My App!

## Docker

Run with: `docker compose up`
```
  </TabItem>
</Tabs>

</LandingSection>

<LandingSection>

## Why Boilerplate?

Boilerplate is designed for platform teams who need to generate infrastructure code, create app starter templates, enforce standards, and automate workflows across an entire organization.

<CardGrid>
  <Card title="Run it anywhere" icon="rocket">
    Boilerplate is a single Go binary with zero runtime dependencies. Download it, run it on your laptop, in CI/CD, or in a container. No Python, no Node, no version conflicts.
  </Card>
  <Card title="Easily capture variables" icon="setting">
    Boilerplate accepts variable values interactively, from the CLI, via YAML files, or through environment variables.
  </Card>
  <Card title="Build powerful templates" icon="puzzle">
    Boilerplate extends Go templates to include serious templating power including 40+ built-in functions, partials, conditionals, capturing shell command output, and more.
  </Card>
</CardGrid>

<SecondaryFeatures features={[
  { href: "/configuration/dependencies/", title: "Composable templates", description: "Build complex scaffolds from smaller, reusable templates using the dependency system." },
  { href: "/configuration/variables/", title: "Variable validation", description: "Seven variable types with built-in validators including required, regex, email, URL, and semver." },
  { href: "/configuration/hooks/", title: "Hooks", description: "Run shell commands before or after rendering to format code, install dependencies, or run tests." },
  { href: "/advanced/remote-templates/", title: "Remote templates", description: "Fetch templates from Git repos, S3, GCS, or HTTP URLs." },
  { href: "/advanced/snippets/", title: "Snippets", description: "Embed code from source files in generated docs to keep examples always in sync." },
  { href: "/cli/flags/", title: "Non-interactive mode", description: "Run fully headless in CI/CD pipelines with --non-interactive, --var-file, and environment variables." },
]} />

</LandingSection>

<LandingSection variant="cta">

## Get started

<CompactCards cards={[
  { href: "/intro/installation/", title: "Install Boilerplate", description: "Install via Homebrew, download a binary, or build from source." },
  { href: "/intro/your-first-template/", title: "Write your first template", description: "Step-by-step tutorial to create and render your first template." },
  { href: "https://github.com/gruntwork-io/boilerplate", title: "View on GitHub", description: "Browse the source, open issues, and contribute." },
]} />

</LandingSection>
