Backstage Metamodel
Backstage is an open source developer portal created at Spotify and now a CNCF project. At its core is the Software Catalog, which uses a small, opinionated metamodel called the System Model. Entities are described in YAML files (usually catalog-info.yaml) stored next to the code, so the people who build the software also maintain its catalog records.
Entity kinds
Software and infrastructure
| Kind | Meaning | Typical spec.type |
|---|---|---|
| Component | A piece of software, typically backed by one source code repository and deployed as a unit | service, website, library |
| API | A boundary between components, described by a machine-readable definition | openapi, asyncapi, graphql, grpc |
| Resource | Infrastructure a component needs at runtime | database, s3-bucket, kafka-topic |
| System | A collection of components, APIs and resources that together expose some functionality | – |
| Domain | A group of systems that share terminology, a domain model and a business purpose | – |
Organization
| Kind | Meaning |
|---|---|
| Group | A team, department or other organizational unit. Groups can be nested with parent and children |
| User | A person, member of one or more groups |
Catalog management
| Kind | Meaning |
|---|---|
| Location | Points to other places to read entity files from |
| Template | A Scaffolder template for creating new components from a blueprint |
Entity envelope
Every entity has the same structure, whatever its kind:
| Field | Purpose |
|---|---|
apiVersion, kind | Which schema the entity follows |
metadata.name | Identifier, unique within kind and namespace |
metadata.namespace | Optional, defaults to default |
metadata.title, description | Human-friendly name and description |
metadata.labels, annotations, tags, links | Extension points for classification, tool integrations and links |
spec | Kind-specific fields, such as owner, lifecycle, system |
relations | Computed by Backstage from spec, not written by hand |
Entities refer to each other with entity references in the form kind:namespace/name, for example group:default/team-checkout. Within the same namespace, the short form team-checkout is enough when the kind is clear from the field.
Relationships
Relations are always generated in pairs, one in each direction:
| Relation | Inverse | Declared by |
|---|---|---|
ownedBy | ownerOf | spec.owner |
partOf | hasPart | spec.system, spec.domain, spec.subcomponentOf |
providesApi | apiProvidedBy | spec.providesApis |
consumesApi | apiConsumedBy | spec.consumesApis |
dependsOn | dependencyOf | spec.dependsOn |
memberOf | hasMember | spec.memberOf (User) |
childOf | parentOf | spec.parent (Group) |
Example
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: order-service
description: REST service for creating and tracking orders.
tags: [java, spring-boot]
spec:
type: service
lifecycle: production
owner: team-checkout
system: sys-order-mgmt
providesApis:
- orders-api
consumesApis:
- payments-api
dependsOn:
- resource:orders-db
---
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: orders-api
spec:
type: openapi
lifecycle: production
owner: team-checkout
system: sys-order-mgmt
definition:
$text: ./openapi.yaml
Extending the model
The built-in kinds cover software well, but they do not cover business architecture. Common extensions:
- Annotations and labels for extra attributes, such as criticality, data classification or a TIME rating. They are cheap to add and need no code.
- Custom kinds, such as
BusinessCapabilityorDataProduct, through a catalog processor. They are more work, but give first-class entities with their own relations. - Lifecycle values are free text. The defaults are
experimental,productionanddeprecated; you can align them with the lifecycle states of your metamodel.
Strengths and limitations
| Strengths | Limitations |
|---|---|
| Maintained as code, reviewed in pull requests | No business layer (capabilities, processes) out of the box |
| Ownership is mandatory and visible | Limited support for target state and roadmaps |
| Integrates with CI/CD, docs, monitoring through plugins | Requires a platform team to run and extend it |
| Small model, easy for engineers to learn | Relationship semantics are coarse (dependsOn covers many things) |
Official documentation
- Software Catalog overview
- System Model: the entity kinds and how they relate
- Descriptor Format of Catalog Entities: the YAML structure and
specfields of each kind - Well-known Relations: relation types and their inverses
- Entity References: the
kind:namespace/nameformat - Well-known Annotations
- Extending the Model: custom kinds, fields and relations