Skip to content

Lesson 2: Golden Paths & Backstage Software Templates (The Scaffolder)

🧠 The Concept (Explain Like I'm 5)

Imagine you want to start a new business. * The Hard Way: You have to manually design a building, hire construction workers, negotiate power lines, install plumbing, apply for permits, and wait 9 months. * The Golden Path (Software Templates): You press a button on a vending machine. In 60 seconds, a fully furnished, licensed, operational office pops out of the ground with electricity, computers, and internet already connected and running.


🏒 The Enterprise Context

  • Elimination of Jira Ticket Ping-Pong: Historically, creating a new production-ready microservice took 2 to 3 weeks: file a ticket for an AWS S3 bucket, file a ticket for a GitHub repo, file a ticket for CI/CD secrets, file a ticket for an EKS namespace.
  • The Scaffolder Engine: Developers fill out a 4-field web form. Backstage executes a declarative sequence:
  • Fetches a vetted, hardened boilerplate repository (Python / Go / Java).
  • Creates a new private GitHub repository.
  • Configures GitHub Actions CI/CD pipelines with SonarQube & Trivy gates.
  • Generates an ArgoCD GitOps manifest in the fleet repository.
  • Registers the new component in the Software Catalog.
  • Total time: Under 90 seconds!

πŸ—ΊοΈ Visual Architecture: The Automated Golden Path Scaffolding Workflow

sequenceDiagram
    autonumber
    actor Dev as πŸ‘©β€πŸ’» Developer
    participant UI as πŸ–₯️ Backstage Web UI
    participant Scaffolder as βš™οΈ Backstage Scaffolder Backend
    participant GitHub as πŸ™ GitHub Enterprise API
    participant GitOps as πŸš€ ArgoCD Fleet Repo

    Dev->>UI: Selects "Production Python FastAPI Microservice"
    UI->>Dev: Prompts for Service Name, Owner, and Cloud Region
    Dev->>UI: Clicks "Create Component"
    UI->>Scaffolder: Triggers template execution with parameters
    Scaffolder->>Scaffolder: Fetches skeleton template & renders variables
    Scaffolder->>GitHub: Creates new repository: org/my-new-service
    Scaffolder->>GitHub: Pushes templated code & CI/CD workflows
    Scaffolder->>GitOps: Commits ArgoCD Application manifest into fleet repo
    Note over GitOps: ArgoCD automatically deploys boilerplate into Dev EKS!
    Scaffolder-->>Dev: Success! Repository, CI/CD, and Live URL Ready in 45s βœ…

πŸ’» Production Code: Backstage Software Template (template.yaml)

apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: fastapi-golden-path
  title: Production Python FastAPI Microservice
  description: "Scaffold a hardened, containerized FastAPI service with CI/CD, Trivy, and ArgoCD"
spec:
  owner: group:platform-team
  type: service

  parameters:
    - title: Service Configuration
      required:
        - component_id
        - owner
      properties:
        component_id:
          title: Service Name
          type: string
          description: Unique kebab-case name of the microservice
        owner:
          title: Owning Engineering Team
          type: string
          ui:field: OwnerPicker

  steps:
    - id: fetch-template
      name: Render Template Skeleton
      action: fetch:template
      input:
        url: ./skeleton
        values:
          component_id: ${{ parameters.component_id }}
          owner: ${{ parameters.owner }}

    - id: publish-github
      name: Create GitHub Repository
      action: publish:github
      input:
        allowedHosts: ['github.com']
        description: 'Hardened microservice generated via Platform Golden Path'
        repoUrl: github.com?owner=my-enterprise-org&repo=${{ parameters.component_id }}
        defaultBranch: main
        repoVisibility: private

    - id: register-catalog
      name: Register in Software Catalog
      action: catalog:register
      input:
        repoContentsUrl: ${{ steps['publish-github'].output.repoContentsUrl }}
        catalogInfoPath: '/catalog-info.yaml'