Creating Custom Templates
Wails ships with a set of built-in templates, but you can create your own and share them with the community. A custom template is just a Git repository — once it is hosted publicly, anyone can scaffold a project from it with a single command.
Generate a template skeleton
Section titled “Generate a template skeleton”The wails3 generate template command produces a ready-to-customise template directory:
wails3 generate template -name MyTemplateAll flags:
| Flag | Description | Default |
|---|---|---|
-name | Template name (required) | — |
-author | Author name | — |
-description | Short description shown in the CLI | — |
-helpurl | URL to documentation for this template | — |
-version | Initial version | v0.0.1 |
-frontend | Copy an existing frontend directory into the template | — |
-dir | Where to write the template directory | Current directory |
Example with all flags:
wails3 generate template \ -name "My Template" \ -author "Your Name" \ -description "React + custom setup" \ -helpurl "https://github.com/yourname/my-template" \ -version "v1.0.0" \ -frontend ./my-existing-frontendThe generated directory looks like this:
MyTemplate/├── template.yaml # Template metadata — edit this├── NEXTSTEPS.md # Guidance for you as the template author — delete before publishing├── README.md # Shown to users after they create a project├── main.go.tmpl # Application entry point├── greetservice.go # Example Go service├── go.mod.tmpl # Go module file├── go.sum.tmpl # Go checksums├── gitignore.tmpl # Becomes .gitignore in generated projects├── Taskfile.tmpl.yml # Build task definitions└── frontend/ # Your frontend codeConfigure template metadata
Section titled “Configure template metadata”Open template.yaml to set your template’s metadata:
# yaml-language-server: $schema=https://v3.wails.io/schemas/template.v3.jsonname: "My Template"shortname: my-templateauthor: Your Namedescription: A template with my preferred setuphelpurl: https://github.com/yourname/my-templateversion: v1.0.0wailsVersion: 3The wailsVersion field is required and must be 3. The # yaml-language-server comment at the top enables autocomplete and inline validation in VS Code (with the YAML extension) and JetBrains IDEs — you can leave it or remove it; it has no effect at runtime.
Customise the template
Section titled “Customise the template”Frontend
Section titled “Frontend”The frontend/ directory is copied verbatim into every project created from your template. Replace the placeholder content with your actual frontend:
cd MyTemplate/frontendnpm create vite@latest .Follow the prompts, then install dependencies:
npm installPass -frontend when generating the template to copy an existing frontend in one step:
wails3 generate template -name MyTemplate -frontend ./my-app/frontendOr copy it manually into the frontend/ directory afterwards.
Build tasks
Section titled “Build tasks”Taskfile.tmpl.yml defines the build workflow. Update the install:frontend:deps and build:frontend tasks to match your frontend toolchain:
tasks: install:frontend:deps: dir: frontend cmds: - npm install # replace with pnpm install, yarn, etc.
build:frontend: dir: frontend deps: [install:frontend:deps, generate:bindings] cmds: - npm run build # replace with your build commandGo application
Section titled “Go application”The main.go.tmpl file is the application entry point. It is processed by Wails’ template engine when a project is created — template variables like {{.ProductName}} are replaced with the values the user supplies.
To edit it as a real Go file (with IDE support), temporarily rename it to main.go, make your changes, then rename it back to main.go.tmpl before committing.
Template variables
Section titled “Template variables”These variables are available in any .tmpl file:
| Variable | Description | Example |
|---|---|---|
{{.ProjectName}} | Project name supplied by the user | "MyApp" |
{{.BinaryName}} | Binary filename | "myapp" |
{{.ProductName}} | Product display name | "My Application" |
{{.ProductDescription}} | Product description | "An awesome application" |
{{.ProductVersion}} | Product version | "1.0.0" |
{{.ProductCompany}} | Company / author name | "My Company Ltd" |
{{.ProductCopyright}} | Copyright string | "Copyright 2024 My Company Ltd" |
{{.ProductComments}} | Additional product comments | "Built with Wails" |
{{.ProductIdentifier}} | Reverse-DNS product identifier | "com.mycompany.myapp" |
{{.ModulePath}} | Go module path | "github.com/you/myapp" |
{{.WailsVersion}} | Wails version used to create the project | "3.0.0" |
{{.Typescript}} | true if the template name ends in -ts | true |
{{.Opn}} | Literal {{ — escape inside templates | {{ |
{{.Cls}} | Literal }} — escape inside templates | }} |
Test your template locally
Section titled “Test your template locally”Before publishing, test the template by creating a project from a local path:
wails3 init -n testproject -t /path/to/MyTemplateThen verify the project works:
cd testprojectwails3 dev # development mode with hot reloadwails3 build # production binaryCheck that:
- Frontend hot reload works
- Go code changes rebuild and relaunch the app
- The production binary in
bin/runs correctly
Publish on GitHub
Section titled “Publish on GitHub”-
Create a public GitHub repository for your template. The repository root must contain
template.yaml. -
Delete
NEXTSTEPS.md— this file is guidance for template authors and must not appear in projects users create from your template. -
Commit and push the template directory contents as the repository root:
Terminal window git initgit add .git commit -m "Initial template"git remote add origin https://github.com/yourname/my-template.gitgit push -u origin main -
Tag a release using semantic versioning:
Terminal window git tag v1.0.0git push origin v1.0.0
Users can now create projects from your template:
# Latest commit on the default branchwails3 init -n myapp -t https://github.com/yourname/my-template
# Pinned to a specific release tagBest practices
Section titled “Best practices”- Write a clear
README.md— this is shown to users after they create a project. Explain how to run, build, and customise the project. - Fill in
helpurl— link to your repository or dedicated documentation. Users see it in the Wails CLI template list. - Pin frontend dependency versions in
package.jsonto avoid broken installs from upstream updates. - Test before tagging — create a fresh project from the tagged release before announcing it to the community.
- Keep
wailsVersion: 3— this field tells Wails which major version the template targets. Do not change it. - Update regularly — keep dependencies current and test against new Wails releases.