Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Build your first Software Template for Backstage

A beginner’s guide to Red Hat Developer Hub Software Templates

August 12, 2025
Evan Shortiss Raghu Banda
Related topics:
Developer ToolsDevSecOpsPlatform engineering
Related products:
Red Hat Developer HubRed Hat OpenShiftRed Hat Plug-ins for Backstage

Share:

    More organizations are adopting the discipline of platform engineering and deploying internal developer portals (IDPs) to streamline developer onboarding and provide self-service capabilities. The goal of these initiatives is to reduce cognitive load on development teams and boost developer productivity.

    Red Hat Developer Hub provides a distribution of the Cloud Native Computing Foundation (CNCF) Backstage project for enterprises building their IDPs. Software Templates are a core feature of Backstage that platform engineering teams can use to automate developer tasks and enable self-service.

    This article guides you through the process of creating your first Software Template for Backstage, importing it into a Red Hat Developer Hub instance, and verifying that it works as planned from the perspective of a developer using the IDP. Specifically, your Software Template will create a new application repository on GitHub that includes a continuous integration (CI) pipeline implemented using a GitHub Actions workflow. The pipeline builds and publishes a container image that can be deployed on Red Hat OpenShift.

    Prerequisites

    This guide assumes that you have administrative access to a Red Hat Developer Hub instance. If you don't have access to an environment, follow this guide to get Red Hat Developer Hub running quickly on Red Hat's Developer Sandbox or refer to the documentation if you'd like to review the available installation options for your own OpenShift cluster.

    You'll also need to configure the GitHub integration and provider to allow the template to create repositories in your GitHub organization.

    Understanding Software Templates in Backstage

    Software Templates are defined using a Backstage-specific YAML structure and are stored in a Git repository that your instance of Red Hat Developer Hub can access. The template YAML contains metadata about the template and a series of parameters and steps that the template collects and performs, respectively. A set of outputs can also be defined to link to resources created by the template. Internally, these templates are processed by a Backstage component known as the scaffolder when developers interact with them.

    Note

    Review the templating fundamentals section of our 10 tips for better Backstage templates guide if you'd like to deep-dive into the structure of a template.yaml file; however, this article covers everything you need to get started.

    A form is rendered in the Red Hat Developer Hub user interface when developers interact with your Software Template. Developers are prompted to input parameters, as seen in Figure 1. When the template is executed, it will usually perform actions provided by Backstage plug-ins, such as creating a repository in GitHub or GitLab.

    Using a Software Template to create a new application based on Next.js
    Figure 1: Using a Software Template to create a new application based on Next.js

    For example, developers can use Software Templates to generate new software projects that adhere to an organization's best practices, use supported frameworks and dependencies, or even provision virtual machines. A platform engineering team typically creates and maintains Software Templates.

    As an example, a platform engineering team might provide a template that teams can use to bootstrap new software services. A well-crafted template could generate repositories with starter code, continuous integration and continuous delivery pipelines, deployment manifests, and include code signing and scanning to implement robust software supply chain security. You can also enable other self-service capabilities such as the provisioning of virtual machines. The process of a developer using a template to bootstrap a new project is illustrated in Figure 2.

    A developer using a Software Template to generate a new project that consists of two repositories; source code and deployment manifests
    Figure 2: A developer using a Software Template to generate a new project that consists of two repositories: source code and deployment manifests.

    Building a Software Template for Backstage

    The basic steps for building your first template are:

    1. Create a public Git repository (using a private repository requires extra configuration that's outside the scope of this article).
    2. Create a template.yaml file in the Git repository.
    3. Define parameters, steps, and outputs in a template.yaml file in the Git repository.
    4. Import the template into Red Hat Developer Hub.
    5. (Optional) Experiment with the template using the Template Editor in Red Hat Developer Hub.

    Create a Git Repository to Store Templates

    The easiest method to import templates into Red Hat Developer Hub is by storing template.yaml files in a Git repository that can be accessed by your Red Hat Developer Hub instance. We've provided a template repository on GitHub to expedite the getting started process—think of it as a template repository that can be used to create your own repository of Software Templates. 😉

    Click the Use this template button, then select Create a new repository to make a copy of the template repository in your GitHub account or organization as shown in Figure 3.

    Creating a new GitHub repository from a template repository
    Figure 3: Creating a new GitHub repository from a template repository.

    The template repository includes a templates directory where each subdirectory contains a template.yaml file. This means you can use it to store all of your templates in a single repository, separating them by folders. You'll use the location.yaml file at the root of the repository to have Red Hat Developer Hub import each template.yaml file in the subfolders; you'll see this in action later.

    Note

    You can create separate repositories for each template.yaml if that better suits your needs, but a single repository is a good option to prevent sprawl.

    Understanding the structure of a Software Template

    Take a look inside the templates/nodejs-backend folder in your new repository. This folder contains a basic template.yaml file that scaffolds a new codebase based on the files in the skeleton directory and creates a Git repository to store the new code. The template collects a single parameter: the name of the application.

    parameters:
      - title: Service Details
        required:
          - name
        properties:
          name:
            title: Service Name
            type: string
            description: Unique name for the service.
            maxLength: 50
            pattern: '^([a-zA-Z][a-zA-Z0-9]*)(-[a-zA-Z0-9]+)*$'

    Next, the template performs two steps: it generates source code using the skeleton directory as a template and publishes the resulting source code to a new GitHub repository.

    The fetch:template action fetches a codebase from the specified directory/URL and renders each file in the tree by passing the specified values as variables. In this case, that means any occurrence of ${{ values.name }} within a file in the skeleton directory will be replaced with the value of name in the rendered codebase.

    The publish:github action will publish the code to a new or existing repository on GitHub. It requires the GitHub Backstage scaffolder plug-in to be installed and the GitHub integration to be configured (more on these later).

    steps:
      - id: generateSource
        name: Generate Node.js Application Codebase
        action: fetch:template
        input:
          url: ./skeleton
          targetPath: ./source
          values:
            name: ${{ parameters.name }}
      - id: publishSource
        name: Create GitHub Repository
        action: publish:github
        input:
          allowedHosts: ['github.com']
          # IMPORTANT: replace "your-org" with the name of your own GitHub Organization
          repoUrl: github.com?owner=your-org&repo=${{ parameters.name }}
          defaultBranch: main
          sourcePath: ./source

    Warning

    Make sure to replace the your-org placeholder in the publishSource step with the name of the GitHub organization that you'll be using with your instance of Red Hat Developer Hub. 
     

    You can find more information about available scaffolder actions by visiting the /create/actions endpoint of your Red Hat Developer Hub instance, as seen in Figure 4.

    Viewing the installed actions in Red Hat Developer Hub
    Figure 4: Viewing the installed actions in Red Hat Developer Hub.

    Import the Templates into Red Hat Developer Hub

    At this point you need administrator access to an instance of Red Hat Developer Hub. You can get access to an instance for free by following the guide in Red Hat Developer Hub: The fastest path to Backstage on Kubernetes.

    Importing the template involves registering the location.yaml from the root of your repository as a Location in Red Hat Developer Hub. Once a Location is registered, Red Hat Developer Hub will occasionally poll it and import the entities specified by the spec.targets field. The specific location.yaml in our example contains a glob pattern that instructs Red Hat Developer Hub to import all template.yaml files in subdirectories of the templates folder in your repository.

    apiVersion: backstage.io/v1alpha1
    kind: Location
    metadata:
      name: my-templates
    spec:
      targets:
        - ./templates/**/template.yaml

    After logging in to your instance of Red Hat Developer Hub, use the Self-service button in the top navigation menu (v1.6+) or the Create menu item (v1.5 and older) on the left to access the Self-service screen. Click the Register Existing Component button, shown in Figure 5.

    Using the self-service screen to register new components in Red Hat Developer Hub
    Figure 5: Using the self-service screen to register new components in Red Hat Developer Hub

    Enter the URL to the location.yaml at the root of your template repository in the URL input. It should resemble the following example, with YOUR_USERNAME replaced by your GitHub username:

    https://github.com/YOUR_USERNAME/backstage-template-template/blob/main/location.yaml

    Click Analyze (Figure 6) and then Import when prompted.

    Registering a new component in Red Hat Developer Hub
    Figure 6: Registering a new component in Red Hat Developer Hub

    All of the templates in your repository will be listed on the Self-service screen after a few seconds. Assuming you didn't add an extra template.yaml, a single template should be visible, as shown in Figure 7.

    Viewing available Software Templates on the self-service screen in Red Hat Developer Hub
    Figure 7: Viewing available Software Templates on the self-service screen in Red Hat Developer Hub.

    Now that the template has been loaded into Red Hat Developer Hub, you can experiment with future edits using the Template Editor. Visit the /create/edit endpoint and select the Template Form Playground to view the Template Editor. Existing templates can be viewed by clicking the Templates menu item and selecting a template, as seen in Figure 8. You can test the addition of new parameters using this interface, before committing them to your templates repository on GitHub.

    Using the Template Editor in Red Hat Developer Hub
    Figure 8: Using the Template Editor in Red Hat Developer Hub

    Test your Template

    Reminder

    My previous article provides a deep-dive on Backstage authentication and providers to get the GitHub integration up and running with Red Hat Developer Hub. Your template will fail to run if the GitHub integration isn't configured with Administrator and Workflow permissions.

    One of the steps in the template you've imported creates a repository on GitHub using the publish:github action. This action is provided by the @backstage/plugin-scaffolder-backend-module-github plug-in. To enable this plug-in in Red Hat Developer Hub, add the following package to your dynamic plug-ins configuration:

    dynamic:
      includes:
        - dynamic-plugins.default.yaml
      plugins:
        - disabled: false
          package: ./dynamic-plugins/dist/backstage-plugin-scaffolder-backend-module-github-dynamic

    Once you've configured the GitHub integration and installed the GitHub scaffolder plug-in for Backstage, your developers can use your template to create a new application. Select the template and enter a name for your new application, as shown in Figure 9.

    Passing parameters to a Software Template in Red Hat Developer Hub
    Figure 9: Passing parameters to a Software Template in Red Hat Developer Hub.

    Review the parameters, then run the template. Once it completes, a link to your new repository will be displayed; click it. Your new repository will contain source code from your template's skeleton. Notice that a GitHub Actions Workflow has also run automatically and published a container image to the repository's Packages section, because the generated repository includes a continuous integration pipeline and Dockerfile. See Figure 10.

    A repository created by a Software Template, and the resulting container image published under Packages
    Figure 10: A repository created by a Software Template and the resulting container image published under Packages.

    Conclusion

    Software Templates enable your platform engineering team to codify best practices, freeing your developers from the tedium of configuring infrastructure related YAML files and learning the ins and outs of your supply chain security, build pipelines, and continuous delivery processes. The template in this example is trivial, but can easily be extended to inject additional fields in the Component defined in the catalog-info.yaml, adding information such as API consumers and providers or TechDocs.

    Go ahead and try Red Hat Developer Hub for yourself using our Developer Sandbox or your own OpenShift environment. When you're ready to take things further, you can take a look at our article that teaches you how to enable continuous delivery using Red Hat Developer Hub and Red Hat OpenShift GitOps.

    Related Posts

    • Red Hat Developer Hub: The fastest path to Backstage on Kubernetes

    • 10 tips for better Backstage Software Templates

    • How to implement developer self-service with Backstage

    • Backstage authentication and catalog providers: A practical guide

    • Building virtual machines with Red Hat Developer Hub: The what, why, and how

    • A platform for building developer portals

    Recent Posts

    • Cloud bursting with confidential containers on OpenShift

    • Reach native speed with MacOS llama.cpp container inference

    • A deep dive into Apache Kafka's KRaft protocol

    • Staying ahead of artificial intelligence threats

    • Strengthen privacy and security with encrypted DNS in RHEL

    What’s up next?

    Boost developer productivity to new heights with a Backstage-based internal developer portal built for enterprises. Learn more and start your trial at no cost.

    Get started
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2025 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue