Custom Templates

Extend Burner with your own project templates using any scripting language.

Template Requirements

Template Location

Place template scripts in the templates directory:

# Default location
~/.burner/templates/
# Open in file explorer
burner config --open-templates

Environment Variables

Burner sets these environment variables before running your template:

VariableDescriptionExample
BURNER_NAME User-provided project name my-experiment
BURNER_PATH Full path to project directory ~/.burner/projects/260115-my-experiment
BURNER_DATED_NAME Dated folder name 260115-my-experiment

The working directory is automatically set to BURNER_PATH.

Interactive Templates

Some templates (like Vite-based ones) require user input. Add a marker comment in the first 10 lines:

# BURNER_INTERACTIVE

This automatically enables interactive mode when using the template.

Example Templates

PowerShell - React with Vite

#!/usr/bin/env pwsh
# react.ps1 - Creates a React app using Vite
Set-Location $env:BURNER_PATH
echo "y" | npm create vite@latest $env:BURNER_DATED_NAME -y -- --template react --no-rolldown
Set-Location $env:BURNER_DATED_NAME
npm install

PowerShell - Svelte (Interactive)

#!/usr/bin/env pwsh
# BURNER_INTERACTIVE
# svelte.ps1 - Creates a Svelte app
Set-Location $env:BURNER_PATH
npm create vite@latest . -- --template svelte-ts
npm install
npm pkg set name=$env:BURNER_NAME

Bash - React

#!/bin/bash
# Creates a React app using Vite
set -e
npm create vite@latest . -- --template react
npm install

Python - Simple Project

#!/usr/bin/env python3
import os
name = os.environ['BURNER_NAME']
with open('main.py', 'w') as f:
    f.write(f'# {name}\nprint("Hello from {name}!")\n')
with open('requirements.txt', 'w') as f:
    f.write('')

PowerShell - .NET with Extra Setup

#!/usr/bin/env pwsh
# dotnet-api.ps1 - Creates a .NET Web API project
dotnet new webapi -o .
dotnet add package Swashbuckle.AspNetCore
dotnet restore

Tips