Skip to content

Remote Templates

Boilerplate supports fetching templates from remote sources using HashiCorp go-getter URLs. This lets you share templates across teams and organizations.

Terminal window
boilerplate \
--template-url "git@github.com:myorg/templates.git//go-service?ref=v1.0.0" \
--output-folder ./output
Terminal window
boilerplate \
--template-url "github.com/myorg/templates//go-service?ref=main" \
--output-folder ./output
<source>//<subdirectory>?ref=<branch-or-tag>
PartDescription
sourceGit repository URL (SSH or HTTPS)
//Separator between repo URL and subdirectory
subdirectoryPath within the repository to the template
?ref=Git ref (branch, tag, or commit SHA)
Terminal window
# Specific tag
git@github.com:myorg/templates.git//microservice?ref=v2.1.0
# Branch
git@github.com:myorg/templates.git//microservice?ref=main
# Commit SHA
git@github.com:myorg/templates.git//microservice?ref=abc123
# Root of repository
git@github.com:myorg/single-template.git

Go-getter supports many sources beyond Git:

  • Gitgit::https://... or git@...
  • HTTP/HTTPS — Direct file downloads
  • S3s3::https://s3.amazonaws.com/bucket/path
  • GCSgcs::https://www.googleapis.com/storage/v1/bucket/path
  • Local files — Absolute or relative paths

Dependencies can also reference remote templates:

dependencies:
- name: shared-lib
template-url: "git@github.com:myorg/templates.git//shared-lib?ref=v1.0.0"
output-folder: ./lib