A CLI tool for quickly creating project boilerplate code from Git repository templates. tmpl allows you to manage multiple template repositories and generate new projects with customizable addons.
This project was started with the boot.dev Hackathon 2025.
At work, I noticed we were constantly starting new projects with remarkably similar code structures. While GitHub templates seemed like an obvious solution, the reality was more complex - everyone's needs were slightly different. One project needed a login screen and database integration, another required database connectivity plus header and footer components, and yet another had its own unique combination of requirements.
Sure, these additions could be done manually after using a basic template, but this approach led to inconsistencies and errors, especially among less experienced team members who struggled with the manual setup process. Junior developers would forget to configure certain components properly, miss important boilerplate code, or introduce bugs while trying to integrate multiple pieces together.
What we needed was a system that could handle the composable nature of modern projects - something that could start with a solid base template and then intelligently layer on exactly the components each project required, without the error-prone manual work.
- Add and manage Git repositories containing project templates
- Create new projects from available templates
- Support for template addons to extend base templates
- Update template repositories to get latest changes
- Simple interactive interface for template selection
go install https://github.com/IC3P3/tmpl@latestEnsure you have Go installed.
git clone https://github.com/IC3P3/tmpl.git
cd tmpl
go build -o tmpl .Move the binary to a location in your PATH:
sudo mv tmpl /usr/local/bin/Or for local installation:
mkdir -p ~/.local/bin
mv tmpl ~/.local/bin/
# Ensure ~/.local/bin is in your PATHAdd a new Git repository containing templates:
tmpl add <name> <repository-url>Example:
tmpl add my-templates https://github.com/IC3P3/tmpl-example.gitView all added template repositories:
tmpl listStart the interactive project creation process:
tmpl createThis will:
- Prompt for a project name
- Show available template repositories
- Display templates within the selected repository
- Allow selection of addons for the chosen template
- Generate the project in the current directory with the project name
Update all template repositories to get the latest changes:
tmpl updateRemove a template repository:
tmpl remove <name>tmpl version- Show version information (coming later)tmpl check- Check template repository syntax (coming later)tmpl init- Initialize a new template repository (coming later)tmpl addon- Add addons to existing projects (coming later)tmpl upload- Upload template repository (coming later)
Template repositories should follow this structure:
repository/
├── tmpl.json # Repository configuration
├── templates/ # Base templates
│ ├── template1/
│ └── template2/
└── addons/ # Optional addons
├── addon1/
└── addon2/The tmpl.json file should contain:
{
"displayname": "My Templates",
"description": "A collection of project templates",
"templates": [
{
"displayname": "Basic Template",
"name": "basic",
"description": "A basic project template",
"addons": ["addon1", "addon2"]
}
],
"addons": [
{
"displayName": "Additional Feature",
"name": "addon1",
"description": "Adds extra functionality"
}
],
"hooks": []
}- Go
- Git (for cloning template repositories)
# Build for current platform
go build -o tmpl .
# Cross-compile for different platforms
GOOS=linux GOARCH=amd64 go build -o tmpl-linux-amd64 .
GOOS=windows GOARCH=amd64 go build -o tmpl-windows-amd64.exe .
GOOS=darwin GOARCH=amd64 go build -o tmpl-darwin-amd64 .The project uses the following main dependencies:
github.com/spf13/cobra- CLI frameworkgithub.com/go-git/go-git/v5- Git operations
tmpl stores its data in ~/.local/share/tmpl/:
repositories.json- List of added repositories<repo-name>/- Cloned template repositories
- Ensure you have write permissions in the target directory
- Verify the repository URL is correct and accessible
- If installed using
go installensureGOPATHis part of thePATH
-
checkcommand - Template repository validation -
uploadcommand - Template repository publishing -
versioncommand - Version of the tool bound to CI/CD - Authentication system - Being able to access private repositories
- Repository configuration enhancements - Set global or repository-based authentication
- Pre-/Post-creation hooks - Select and execute script
- File content modification - Let templates change files instead of just copying
- GitHub Actions workflows - Testing and building of new versions
- Release automation - Create releases on SemVer tags
- Refacor and code cleanup - Improve code written by a Go beginner (me) in the hectic of a Hackathon