Lesson 1: Internal Developer Portals (IDPs) & Spotify Backstage
๐ง The Concept (Explain Like Iโm 5)
Imagine you join a giant multinational company with 2,000 employees and 1,500 active microservices. On your first day as an engineer, you have simple, basic questions:
- Who owns the
customer-billing-service? (The engineer who wrote it left 2 years ago!) - Where is the API documentation?
- How do I see if this service is healthy without logging into 5 different monitoring consoles?
- Who is holding the on-call pager right now if it crashes?
Before Internal Developer Portals, you spent weeks asking on Slack, navigating 20 browser tabs, and guessing.
Spotify Backstage is the single corporate intranet homepage for software engineering. It gathers every microservice, API, database, documentation page, and monitoring dashboard in the entire company into a single unified, searchable directory (The Software Catalog).
๐ข The Enterprise Context: Combating Cognitive Overload
In modern organizations, software development suffers from Developer Friction and Cognitive Overload:
- Developers must juggle 15 disconnected interfaces: AWS Management Console, GitHub, ArgoCD, Datadog, PagerDuty, SonarQube, Jira, and Confluence.
- According to DORA (DevOps Research and Assessment), high cognitive load directly correlates with slower deployment frequency and higher change failure rates.
flowchart TD
subgraph TheFragmentedNightmare ["The Fragmented Developer Nightmare (15 Disconnected Tools)"]
direction TB
DevBad["๐จโ๐ป Confused Developer"] --> AWSUI["AWS Console (Where is my DB?)"]
DevBad --> DatadogUI["Datadog (Which dashboard?)"]
DevBad --> PagerUI["PagerDuty (Who is on call?)"]
DevBad --> GitHubUI["GitHub (Where is the repo?)"]
DevBad --> ConfluenceUI["Confluence (Outdated 2021 docs)"]
DevBad --> ArgoUI["ArgoCD (Which cluster?)"]
end
subgraph TheBackstageSolution ["The Internal Developer Portal (Spotify Backstage)"]
direction TB
DevGood["๐จโ๐ป Empowered Developer"] --> BackstagePortal["<b>Spotify Backstage IDP</b><br/>One Pane of Glass"]
BackstagePortal --> Catalog["1. Software Catalog (Ownership & Taxonomy)"]
BackstagePortal --> TechDocs["2. TechDocs (Always up-to-date Docs-as-Code)"]
BackstagePortal --> Scaffolder["3. Software Templates (Golden Paths)"]
BackstagePortal --> Scorecards["4. Security & Quality Scorecards"]
end
๐บ๏ธ Visual Architecture: Backstage Architecture & Catalog Aggregation
Backstage is an open-source framework created by Spotify and donated to the Cloud Native Computing Foundation (CNCF). It uses a decentralized metadata model where the service repository owns its metadata:
flowchart TD
subgraph Repositories ["Distributed Git Repositories (Decentralized Metadata)"]
R1["<b>order-service</b><br/>catalog-info.yaml<br/>docs/index.md"]
R2["<b>payment-service</b><br/>catalog-info.yaml<br/>docs/index.md"]
R3["<b>auth-service</b><br/>catalog-info.yaml<br/>docs/index.md"]
end
subgraph BackstageBackend ["Backstage Node.js Backend"]
Discovery["<b>Catalog Discovery Engine</b><br/>(Polls GitHub / GitLab via Webhooks & GitHub App)"]
Parser["Entity Parser & Validator<br/>(Validates OpenAPI & Backstage Schemas)"]
DBCatalog[("PostgreSQL Metadata Store")]
Discovery --> Parser --> DBCatalog
end
subgraph BackstageFrontend ["Unified React Frontend"]
CatalogUI["Software Catalog Browser"]
TechDocsUI["TechDocs Markdown Reader"]
PluginHub["Plugin Hub"]
end
subgraph ExternalServices ["Aggregated Enterprise Observability & Tooling"]
Argo["ArgoCD Plugin"]
DD["Datadog Plugin"]
PD["PagerDuty Plugin"]
Snyk["Snyk / Trivy Plugin"]
end
R1 -.->|"catalog-info.yaml"| Discovery
R2 -.->|"catalog-info.yaml"| Discovery
R3 -.->|"catalog-info.yaml"| Discovery
DBCatalog --> CatalogUI
DBCatalog --> TechDocsUI
Argo -.-> PluginHub
DD -.-> PluginHub
PD -.-> PluginHub
Snyk -.-> PluginHub
PluginHub --> CatalogUI
CatalogUI --> DevUser["๐จโ๐ป Platform Engineer / Developer"]
๐ฌ Under the Hood: The Backstage Entity Data Model
Backstage organizes an enterpriseโs software architecture into a clean, hierarchical graph composed of core Entity Kinds:
erDiagram
DOMAIN ||--o{ SYSTEM : contains
SYSTEM ||--o{ COMPONENT : groups
COMPONENT ||--o{ API : provides
COMPONENT ||--o{ RESOURCE : dependsOn
USER ||--o{ GROUP : memberOf
GROUP ||--o{ COMPONENT : owns
DOMAIN {
string name "e-commerce"
}
SYSTEM {
string name "checkout-system"
}
COMPONENT {
string name "order-service"
string type "service"
}
API {
string name "order-api-v2"
string type "openapi"
}
RESOURCE {
string name "order-database"
string type "rds-postgresql"
}
The Core Entity Kinds:
- Domain: The top-level business vertical (e.g.
Retail,Financial Services,Supply Chain). - System: A collection of interacting components and resources that deliver a business capability (e.g.
checkout-system). - Component: An individual piece of software (a backend service, frontend website, library, or data pipeline).
- API: The formal contract exposed by a component (OpenAPI / Swagger spec, gRPC Protobuf, or GraphQL schema).
- Resource: Physical or cloud infrastructure needed by a component (an AWS RDS database, S3 bucket, or Kafka topic).
- Group & User: The human organizational structure (synchronized automatically with Okta, Microsoft Entra ID, or GitHub Teams).
๐ TechDocs: The Docs-Like-Code Revolution
Traditional documentation written in Confluence or Google Docs decays quickly because it lives separate from the code. When an engineer modifies an API endpoint in Git, they forget to update Confluence.
TechDocs enforces Docs-as-Code:
- Documentation is written in Markdown inside a
docs/folder in the same Git repository as the application code. - A
mkdocs.ymlfile configures navigation and plugins. - Every Pull Request updates both code and documentation atomically.
- CI/CD (GitHub Actions) builds the documentation into HTML and publishes it to an enterprise AWS S3 bucket.
- Backstage reads the pre-rendered HTML from S3 and renders it inside the developer portal with full-text search!
๐ป Production Manifest: Complete catalog-info.yaml Ecosystem
A service repository contains a catalog-info.yaml at its root declaring its identity, ownership, APIs, and tooling integrations:
# catalog-info.yaml - Production Component & API Definition
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: order-processing-service
description: "Core high-throughput asynchronous order processing and checkout engine"
annotations:
# 1. Source Code Repository
github.com/project-slug: "my-enterprise-org/order-processing"
# 2. TechDocs Reference (Lives in same repo)
backstage.io/techdocs-ref: "dir:."
# 3. Live Observability Plugins
datadog.com/service-name: "order-processor-production"
pagerduty.com/integration-key: "pd-svc-key-928172"
# 4. Continuous Delivery & GitOps
argocd/app-name: "order-service-production"
# 5. Security & CVE Scans
snyk.io/org-name: "enterprise-core-sec"
tags:
- python
- fastapi
- tier-1-critical
- pci-compliant
spec:
type: service
lifecycle: production
# Enforces human team accountability!
owner: group:checkout-engineering-team
system: ecommerce-checkout-system
# Exported APIs
providesApis:
- order-api-v2
# Infrastructure Dependencies
dependsOn:
- resource:default/customer-database-rds
- component:default/payment-gateway-service
---
# Declare the API contract directly alongside the component!
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: order-api-v2
description: "RESTful OpenAPI specification for order creation and query"
spec:
type: openapi
lifecycle: production
owner: group:checkout-engineering-team
system: ecommerce-checkout-system
definition: |
openapi: "3.0.0"
info:
title: Order API
version: "2.0.0"
paths:
/v2/orders:
post:
summary: Create a new customer order
responses:
'201':
description: Order created successfully
โ๏ธ Production Backend Configuration: app-config.yaml
To configure Backstage to automatically discover repositories across an entire GitHub Enterprise organization:
# app-config.yaml snippet
app:
title: Enterprise Developer Portal
baseUrl: https://portal.enterprise.corp
organization:
name: Acme Enterprise Corp
integrations:
github:
- host: github.com
apps:
- appId: 123456
clientId: iv1.abc123xyz
clientSecret: ${GITHUB_APP_CLIENT_SECRET}
webhookSecret: ${GITHUB_APP_WEBHOOK_SECRET}
privateKey: ${GITHUB_APP_PRIVATE_KEY}
catalog:
rules:
- allow: [Component, System, API, Resource, Group, User, Template]
locations:
# Automatically scan all repositories in the organization for catalog-info.yaml
- type: github-discovery
target: 'https://github.com/my-enterprise-org/*/blob/main/catalog-info.yaml'
techdocs:
builder: 'external' # Pre-built in CI via GitHub Actions
generator:
runIn: 'docker'
publisher:
type: 'awsS3'
awsS3:
bucketName: 'enterprise-techdocs-storage-production'
region: 'us-east-1'
๐งญ Step-by-Step Operational Playbook: Onboarding an Engineering Org into the Backstage Software Catalog
Follow this step-by-step operational procedure to populate a Backstage Internal Developer Portal (IDP) automatically without manual data entry:
Step 1: Sync Teams & Users Automatically from Entra ID / GitHub Org
- Plain-English Goal: Before registering microservices, ingest
UserandGroupentities from your identity provider so every service has a validspec.ownerteam. - Action: Configure the GitHub Org / Microsoft Graph entity provider in
app-config.yamlon a 30-minute schedule and verify group ingestion:curl -s http://backstage.internal:7007/api/catalog/entities?filter=kind=group | jq ".[].metadata.name"
Step 2: Define the Domain and System Hierarchy
- Plain-English Goal: Group related microservices and databases under a business
Domain(e.g.,checkout-domain) andSystem(e.g.,order-processing-system) so architects can visualize blast radius. - Action: Commit
system-info.yamlto the architecture repository and verify the entity graph in Backstage UI.
Step 3: Commit catalog-info.yaml to Microservice Repositories
- Plain-English Goal: Place a declarative
catalog-info.yamlat the root of each microservice Git repository linking theComponentto itsAPI,Resource(RDS DB), PagerDuty service ID, and ArgoCD app label. - Action:
# Validate YAML syntax and required annotations locally in CI before merge: yq e ".metadata.annotations" catalog-info.yaml
Step 4: Enable GitHub Autodiscovery & Webhook Refresh
- Plain-English Goal: Configure the Backstage GitHub Discovery processor so any new repository containing a
catalog-info.yamlfile appears in the portal automatically within seconds of agit push. - Action:
# Check Backstage catalog stitcher logs for ingestion errors or orphan entities: kubectl logs -n backstage deploy/backstage-backend | grep -i "catalog"
๐ ๏ธ Real-World Troubleshooting & Failure Modes
1. Catalog Discovery Fails with GitHub 403 Rate Limit
- Symptom: Backstage catalog stops updating. Logs show:
HttpError: API rate limit exceeded for personal access token. - Root Cause: Personal Access Tokens (PATs) have a strict limit of 5,000 requests/hour. In an organization with 500 repositories, Backstage exhausts the limit in minutes.
- Fix: Always use GitHub Apps instead of PATs. GitHub Apps provide 15,000+ requests/hour per installation and scale dynamically with organization repository count.
2. โEntity Missing Required Ownerโ Validation Error
- Symptom: A developerโs
catalog-info.yamlis rejected during ingestion. - Root Cause: Backstage strictly validates schemas. If
spec.owneris missing or points to a non-existent group (e.g.owner: group:non-existent-team), Backstage marks the entity invalid to prevent orphan code in production!
๐ Knowledge Check & Real-World Interview Scenarios
A traditional IT manager asks: โWhy donโt we just maintain a single giant MySQL database or spreadsheet where platform engineers type in the names and owners of all 1,500 microservices, instead of scattering thousands of catalog-info.yaml files across Git repos?โ
As a Platform Architect, provide 3 critical failure modes of centralized metadata, and explain why the decentralized catalog-info.yaml model succeeds.
โ Answer & Explanation
Why Centralized Spreadsheets/Databases Fail:
- Guaranteed Desynchronization & Decay: Centralized registries rely on manual out-of-band updates. When developers rename a service, change on-call rotations, or deprecate an API, they never remember to update the central database. Within 3 months, 40% of the registry is stale misinformation.
- Lack of Version Control & Branch Alignment: A central database represents only one static state. When a team creates a major v2 refactor in a Git branch, a central database cannot reflect branch-specific APIs or preview changes during Pull Requests.
- Destroyed Developer Ownership: Centralized IT tracking feels like compliance paperwork. When metadata lives directly in
catalog-info.yamlnext tomain.py, developers own and update it as part of standard code reviews.
In early Backstage trials, teams configure techdocs.builder: 'local', meaning the Backstage backend container spins up Docker and runs Python mkdocs build on-the-fly whenever a user clicks on a documentation page.
What happens when 500 developers access the portal simultaneously, and why must enterprises migrate to techdocs.builder: 'external'?
โ Answer & Explanation
The On-Demand Meltdown:
- Generating documentation on-the-fly inside the Backstage container requires running Docker-in-Docker (or Python child processes) dynamically.
- When 500 developers browse documentation, Backstage attempts to compile hundreds of Markdown trees simultaneously, exhausting CPU and memory on the Backstage host, resulting in 30-second page load times and server crashes.
The Enterprise Solution (techdocs.builder: 'external'):
- Documentation is pre-compiled in CI/CD pipelines (GitHub Actions / GitLab CI) whenever a commit merges into
main. - The compiled static HTML and assets are uploaded directly to an AWS S3 bucket.
- Backstage simply acts as a fast static file reader from S3, delivering instant sub-second page loads with zero CPU overhead on the portal!