Free — no signup required

Backstage Pillar 2: Scaffolding and Templates

3 min read

The "Blank Page" Problem

Starting a new project is surprisingly hard. A developer needs to:

  1. Create a Git repository with the right naming convention.
  2. Set up the basic framework code (e.g., a Spring Boot skeleton).
  3. Configure CI/CD pipelines (e.g., GitHub Actions YAML files).
  4. Write a Dockerfile using the company's approved secure base image.
  5. Create Kubernetes manifests with resource limits and health checks.
  6. Hook up monitoring, logging, and alerting.
  7. Register the service in the Software Catalog.

Usually, developers solve this by finding an old project and copy-pasting the configuration. This leads to configuration drift — bad practices, outdated base images, and deprecated API versions get copied around forever. A security vulnerability fixed in one service's Dockerfile never gets propagated to the 40 services that copied it.

Software Templates (Scaffolding)

Backstage uses Software Templates to solve this. A template is a YAML definition that describes a form (inputs) and a series of automated steps (actions) to execute when the form is submitted.

A developer goes to the portal, clicks "Create New Service," and selects a template like "Java Spring Boot Microservice." They fill out a simple form:

  • Service Name: inventory-service
  • Owner Team: team-supply
  • Slack Alert Channel: #alerts-team-supply

The portal takes those inputs and automatically:

  1. Creates a new GitHub repository named inventory-service.
  2. Populates it with a fully working Spring Boot skeleton.
  3. Adds a Dockerfile using the company's approved base image.
  4. Adds a .github/workflows/deploy.yaml CI/CD pipeline.
  5. Adds a catalog-info.yaml pre-filled with the owner and service name.
  6. Registers the new service in the Software Catalog.

The developer can start writing feature code on day one, minute one. Every new service starts from the same secure, compliant baseline.

Here is a simplified Software Template definition showing the structure:

apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: java-spring-boot-service
  title: Java Spring Boot Microservice
  description: Creates a new production-ready Spring Boot service.
spec:
  owner: group:platform-team
  type: service

  parameters:
    - title: Service Details
      required: [serviceName, owner, slackChannel]
      properties:
        serviceName:
          title: Service Name
          type: string
          description: Unique name for the service (e.g., inventory-service)
        owner:
          title: Owner Team
          type: string
          ui:field: OwnerPicker
        slackChannel:
          title: Slack Alert Channel
          type: string

  steps:
    - id: fetch-template
      name: Fetch Base Template
      action: fetch:template
      input:
        url: ./skeleton
        values:
          serviceName: ${{ parameters.serviceName }}
          owner: ${{ parameters.owner }}

    - id: publish
      name: Publish to GitHub
      action: publish:github
      input:
        repoUrl: github.com?owner=acme-corp&repo=${{ parameters.serviceName }}

    - id: register
      name: Register in Catalog
      action: catalog:register
      input:
        repoContentsUrl: ${{ steps.publish.output.repoContentsUrl }}
        catalogInfoPath: /catalog-info.yaml
Interview Tip

A common interview question is: "How do you prevent configuration drift across hundreds of microservices?" The IDP answer is Software Templates combined with a policy of updating the template and re-scaffolding or patching existing services. Some teams use tools like Renovate Bot or custom scripts to propagate template changes (like a base image update) to all services that were created from that template. The catalog's metadata makes it possible to find all services using a given template — something impossible with ad-hoc copy-paste.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free