Create Software Templates

To automate the setup of standardized environments for your developers, create a template definition that describes the project starter kit and the actions required to generate it.

Before you begin

Procedure

  1. Create a directory in your Git repository for the Software Template.
  2. Create a file named template.yaml in that directory.
  3. In the template.yaml file, define the apiVersion, kind, and metadata to identify the starter kit in the software catalog.
  4. Add a spec section to define the parameters that a developer must provide when they use the Software Template.
  5. Define the steps required to generate the project, which can include fetch:template to retrieve the skeleton and publish:github to create the new repository.
    Important

    You must include TechDocs in your Software Templates to ensure that documentation is automatically generated for every new project created from the Software Template.

    Example of a software template:
    apiVersion: scaffolder.backstage.io/v1beta3
    kind: Template
    metadata:
      name: basic-node-service
      title: Basic Node.js Service
      description: A starter kit for a standardized Node.js microservice.
      tags:
        - nodejs
        - recommended
    spec:
      owner: platform-team
      type: service
      parameters:
        - title: ProjectDetails
          required:
            - name
            - owner
          properties:
            name:
              title: Name
              type: string
              description: Unique name for the new repository.
            owner:
              title: Owner
              type: string
              description: The group responsible for this component.
              ui:field: OwnerPicker
              ui:options:
                allowedKinds:
                  - Group
      steps:
        - id: fetch-base
          name: Fetch Skeleton
          action: fetch:template
          input:
            url: ./skeleton
            values:
              name: ${{ parameters.name }}
              owner: ${{ parameters.owner }}
        - id: publish
          name: Publish to GitHub
          action: publish:github
          input:
            allowedHosts: ['github.com']
            description: This is ${{ parameters.name }}
            repoUrl: github.com?owner=my-org&repo=${{ parameters.name }}
      output:
        links:
          - title: Repository
            url: ${{ steps['publish'].output.remoteUrl }}

Results

  1. Inspect the template.yaml file to ensure the YAML syntax is valid.
  2. Confirm that the name and action fields are defined so the template is correctly recognized as a Scaffolder task.
  3. Check that the defined parameters match the variables used in your Software Template skeleton files.
  4. Navigate to the form playground at <instance_url>/create/template-form and test the Software Template configuration to confirm the fields and logic render as intended.