Using the Template Editor
The Template Editor is a browser-based sandbox for experimenting with templates. It offers a live preview and an interactive environment to prototype ideas, understand how templates work, and test configurations before deploying them to your software-templates repository.
The Template Editor is designed for:
-
🚀 Rapid prototyping - Quickly test template ideas
-
📚 Learning - Understand how templates work through hands-on experimentation
-
🧪 Testing - Validate parameter forms, custom fields, and template logic
-
🔧 Debugging - Troubleshoot issues in a controlled environment
Overall, it simplifies template development by providing everything you need in one place. Whether you're creating your first template or debugging complex configurations, the Template Editor streamlines your workflow from idea to deployment.
Prerequisites
-
Knowledge of formatting YAML files.
-
Knowledge of Git and creating pull requests.
-
You must be a member of the G_GITHUB_PRD_ACCESS global group to contribute templates. To become a member, follow the instructions in the OKTA Workforce Knowledge Base article.
-
Review the anatomy of a template. Understanding the structure will help you organize your template logically and ensure it properly collects inputs and executes actions.
-
You must have the
software-templatesrepo cloned on your computer. To clone it, see Clone the Templates repo for details. -
Understand the structure of the
software-templatesrepo. For information, see Template Repo Structure
Choose the best UI option
Each tool serves a specific purpose in the template development lifecycle, allowing you to focus on one aspect at a time for maximum efficiency.
| Option | Description | When to Use |
|---|---|---|
| Create New Template | Provides a minimal blank template to start from scratch. Perfect for:
| Building a new template and want a quick starting point |
| Load Template Directory | Upload and edit an existing template file directly within the portal. Perfect for:
| Modifying existing templates or testing complete workflows |
| Template Form Playground | Design and test parameter forms in isolation. Perfect for:
| Perfecting form UX without worrying about template logic |
| Custom Field Editor | Explore, test, and understand custom form fields before using them in your templates. Perfect for:
| Default form fields don't meet your needs |
Debugging Issues
-
Form problems? → Template Form Playground
-
Action failures? → Load Template Directly
-
Field behavior? → Custom Field Editor
Common gotchas
-
YAML indentation - Be precise with spacing
-
Parameter references - Use
${{ parameters.fieldName }} -
Step IDs - Must be unique within a template
-
Custom fields - Not all may be available in your instance
-
Saving behavior - Create New Template saves to browser storage; Load Template Directory saves to original files
Simple tutorials to try
- Basic structure
- Experiment with parameters
- Test a new template idea
- Test Custom Fields
-
Select Create New Template in the Template Editor.
-
Create a folder for the template either locally or your local version of the
software-templatesrepo. Then click Select to populate the minimal template files. -
Once populated, you'll be presented with two messages to view and save the template files in the folder. Select View files and then Save Changes.
-
Paste the following yaml code in the
template.yamlfile.apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
name: learning-template
title: My Learning Template
description: Understanding how templates work
spec:
owner: user:guest
type: service
# These are the form fields users will fill out
parameters:
- title: Basic Information
required:
- name
properties:
name:
title: Name
type: string
description: Name of the component
# These are the actions the template performs
steps:
- id: log
name: Log Message
action: debug:log
input:
message: 'Hello ${{ parameters.name }}!'
# This defines what the user sees after the template runs
output:
text:
- title: 'Template Execution Complete! 🎉'
content: |
Your learning template has successfully executed! -
Provide a name and click Review > Create to run a dry test.
-
Check the Log and Output tabs in the Dry-run results.
-
Modify the template and test again.
Use the Template Form Playground to rapidly test different parameter types.
Learning Points:
-
See how different field types render
-
Test validation rules
-
Understand default values
-
Experiment with field dependencies
parameters:
- title: Experiment with Fields
properties:
textExample:
title: Text Field
type: string
default: 'Default value'
numberExample:
title: Number Field
type: number
minimum: 1
maximum: 10
selectExample:
title: Dropdown
type: string
enum:
- option1
- option2
- option3
enumNames:
- 'First Option'
- 'Second Option'
- 'Third Option'
booleanExample:
title: Checkbox
type: boolean
default: false
You have an idea for a template but want to validate it works before investing time in a full implementation.
-
Start in Template Form Playground
-
Design your parameter form
-
Test the user experience
-
Validate your field choices
-
-
Move to Create New Template
-
Copy your tested parameters
-
Add template steps
-
Test with dry runs
-
-
Iterate Quickly
-
Make changes
-
Test immediately
-
No Git commits needed
-
No PR reviews required
-
Example: Prototyping a service template
# Start simple in the playground
parameters:
- title: Service Configuration
properties:
name:
title: Service Name
type: string
pattern: '^[a-z][a-z0-9-]*$'
language:
title: Programming Language
type: string
enum: ['java', 'python', 'nodejs']
includeDatabase:
title: Include Database?
type: boolean
# Conditional field - only shows if includeDatabase is true
databaseType:
title: Database Type
type: string
enum: ['postgresql', 'mysql', 'mongodb']
condition:
properties:
includeDatabase:
const: true
Before using custom fields in production templates, test them in the Custom Field Editor:
-
Discover available fields
-
Browse the dropdown list
-
See what's installed in your instance
-
-
Test configurations
# Example: Testing OwnerPicker
ui:field: OwnerPicker
ui:options:
catalogFilter:
kind: Group
metadata.namespace: default -
Validate behavior
-
Does it show the right options?
-
Does filtering work correctly?
-
Are the selected values in the right format?
-