Backstage: Spotify's Open Source Developer Portal
Backstage is an open source platform created by Spotify and donated to the Cloud Native Computing Foundation (CNCF) in 2020. It represents today's de facto standard for building developer portals and the foundation upon which many organizations build their Internal Developer Platform (IDP).
Backstage solves a problem every growing organization faces: tool and information fragmentation. Instead of navigating between dozens of dashboards, wikis, repositories, and tools, developers find everything in a single portal: the service catalog, documentation, templates for new projects, deployment status, and performance metrics.
In this article, we will explore Backstage's architecture, its core components, how to configure and customize it, and how to build custom plugins to integrate it with your ecosystem.
What You'll Learn
- Backstage architecture: frontend, backend, database, and plugin system
- Software Catalog: how to model and manage all organization services
- Software Templates: scaffolding new services through the portal
- TechDocs: documentation as code integrated into the portal
- Plugin development: creating custom plugins to integrate your tools
- Deployment: Kubernetes, Docker Compose, and production configuration
Backstage Architecture
Backstage has a modular architecture based on three main components:
- Frontend (App): React single-page application providing the user interface. Highly customizable through themes, layouts, and frontend plugins
- Backend: Node.js/Express server handling APIs, authentication, database, and backend plugin orchestration
- Plugins: independent modules that add functionality. Each plugin has a frontend and/or backend component. The ecosystem includes hundreds of plugins for integrating tools like GitHub, Kubernetes, PagerDuty, Datadog, and many more
This plugin architecture is Backstage's true strength: it allows starting with core features and progressively adding integrations without ever having to rewrite the platform.
# Backstage: app-config.yaml configuration
app:
title: "Company Developer Portal"
baseUrl: https://backstage.company.io
organization:
name: "Company Inc."
backend:
baseUrl: https://backstage.company.io
listen:
port: 7007
database:
client: pg
connection:
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
user: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
auth:
environment: production
providers:
github:
production:
clientId: ${AUTH_GITHUB_CLIENT_ID}
clientSecret: ${AUTH_GITHUB_CLIENT_SECRET}
integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}
catalog:
import:
entityFilename: catalog-info.yaml
pullRequestBranchName: backstage-integration
rules:
- allow: [Component, System, API, Resource, Location, Template, Group, User]
locations:
- type: url
target: https://github.com/company/backstage-catalog/blob/main/all-components.yaml
- type: url
target: https://github.com/company/software-templates/blob/main/all-templates.yaml
Software Catalog: The Heart of Backstage
The Software Catalog is Backstage's central component. It is a centralized registry
of all software components in the organization: services, libraries, APIs, infrastructure resources,
documentation, and teams. Each entity in the catalog is described by a YAML file called
catalog-info.yaml residing in the component repository's root.
The catalog supports several entity types:
- Component: a service, library, or application
- API: an interface exposed by a component (REST, gRPC, GraphQL, events)
- System: a logical grouping of components forming a system
- Resource: an infrastructure resource (database, S3 bucket, Kafka cluster)
- Group: a team or organizational unit
- User: an individual user in the organization
# catalog-info.yaml: service definition in the catalog
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: checkout-service
description: "Service for checkout and payment management"
annotations:
github.com/project-slug: company/checkout-service
backstage.io/techdocs-ref: dir:.
pagerduty.com/service-id: PXXXXXX
grafana/dashboard-selector: "checkout"
sonarqube.org/project-key: checkout-service
tags:
- typescript
- nestjs
- payments
links:
- url: https://checkout.company.io/api/docs
title: API Documentation
icon: docs
- url: https://grafana.company.io/d/checkout
title: Grafana Dashboard
icon: dashboard
spec:
type: service
lifecycle: production
owner: team-checkout
system: e-commerce
providesApis:
- checkout-api
consumesApis:
- payment-gateway-api
- inventory-api
dependsOn:
- resource:checkout-database
- resource:checkout-redis
---
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: checkout-api
description: "REST API for checkout operations"
spec:
type: openapi
lifecycle: production
owner: team-checkout
system: e-commerce
definition:
$text: ./openapi.yaml
Software Templates: Scaffolding from the Portal
Software Templates are Backstage's scaffolding engine. They allow developers to create new services, libraries, or infrastructure components directly from the developer portal, following the organization's Golden Paths.
The typical flow is:
- The developer selects a template from the catalog (e.g., "REST API Microservice")
- Fills in a form with required information (name, team owner, technical options)
- Backstage executes a series of automated steps: code scaffolding, GitHub repository creation, CI/CD setup, catalog registration
- In a few minutes, the developer has a working service with all best practices built in
Software Templates Impact
Organizations adopting Backstage Software Templates report a 75% reduction in time-to-first-deploy. A new microservice that previously required 2-3 days of setup is now operational in 15-30 minutes, complete with CI/CD, monitoring, and documentation.
TechDocs: Documentation in the Portal
TechDocs is the documentation system built into Backstage that implements the docs-as-code paradigm. Documentation lives in the service repository as Markdown files, is automatically compiled, and made accessible through the developer portal.
The benefits of TechDocs are:
- Co-location: documentation lives alongside the code, so it gets updated together
- Discoverability: all documentation is searchable from a single point in the portal
- Standardization: uniform format for all organizational documentation
- Automation: compilation and publishing are automatic via CI/CD
# mkdocs.yml: TechDocs configuration for a service
site_name: Checkout Service
site_description: "Technical documentation for the checkout service"
nav:
- Home: index.md
- Architecture:
- Overview: architecture/overview.md
- Database Schema: architecture/database.md
- API Design: architecture/api-design.md
- Development:
- Getting Started: development/getting-started.md
- Local Setup: development/local-setup.md
- Testing: development/testing.md
- Operations:
- Deployment: operations/deployment.md
- Monitoring: operations/monitoring.md
- Runbook: operations/runbook.md
- ADR:
- 001 - Database Choice: adr/001-database-choice.md
- 002 - Cache Strategy: adr/002-cache-strategy.md
plugins:
- techdocs-core
markdown_extensions:
- admonition
- codehilite
- pymdownx.superfences
- pymdownx.tabbed
Plugin Development
Backstage's true power lies in its plugin ecosystem. Beyond the hundreds of community plugins, every organization can create custom plugins to integrate their internal tools, dashboards, and workflows.
A typical Backstage plugin comprises:
- Frontend plugin: React components that add pages, cards, or tabs to the interface
- Backend plugin: APIs and server-side logic consumed by the frontend
- Common package: TypeScript types, interfaces, and utilities shared between frontend and backend
The most popular plugins in the ecosystem include: Kubernetes (pod and deployment visualization), GitHub Actions (workflow status), PagerDuty (on-call and incidents), Grafana (embedded dashboards), SonarQube (code quality), and Cost Insights (cloud cost analysis).
Deploying Backstage
Backstage can be deployed in several ways, depending on the organization's needs:
- Kubernetes: the recommended method for production, with Helm charts or custom manifests
- Docker Compose: ideal for local development and small teams
- Roadie: managed SaaS version of Backstage, for those who prefer not to manage infrastructure
# Kubernetes deployment: Helm values for Backstage
backstage:
image:
registry: ghcr.io
repository: company/backstage
tag: latest
replicas: 2
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
extraEnvVars:
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: backstage-db-credentials
key: host
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: backstage-github-token
key: token
ingress:
enabled: true
host: backstage.company.io
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
tls:
- secretName: backstage-tls
hosts:
- backstage.company.io
postgresql:
enabled: true
auth:
database: backstage
username: backstage
primary:
persistence:
size: 10Gi
Practical Advice
Start with a minimal Backstage installation: Software Catalog + TechDocs + 2-3 essential plugins (GitHub, Kubernetes, a monitoring tool). Add plugins progressively based on developer feedback. A portal that is too complex at launch risks confusing rather than helping.
Related deep dive: 05 - Infrastructure as Code Patterns: Terraform, Pulumi e Policy as Code.
Related deep dive: 06 - Service Catalog e CMDB: Gestione e Governance dei Servizi.
Frequently asked questions
What is Backstage and what problem does it solve?
Backstage is an open source platform created by Spotify that solves the problem of tool and information fragmentation in growing organizations, allowing developers to find everything they need in a single portal.
How does Backstage's plugin architecture work?
Backstage's plugin architecture allows starting with core features and progressively adding integrations without having to rewrite the platform, making it easy to customize and extend.
What is the Software Catalog and what are its benefits?
The Software Catalog is a centralized registry of all software components in an organization, providing a single source of truth for developers and allowing them to create new services quickly using Software Templates.
How can organizations integrate their internal tools with Backstage?
Organizations can create custom plugins to integrate their internal tools, dashboards, and workflows with Backstage, making it easy to extend the platform to meet their specific needs.
Related deep dive: Poker e Retro di ProjectHub: una slice reale BE-FE, dove lo schema regge il tempo reale.
Commenti
Caricamento commenti...
Sign in to comment