Skip to content

Relationships

A Relationship is a directed edge from a consumer to the provider it depends on. It is declared under the consumer, with to naming the provider:

payments/model.yaml
payments-service:
name: Payments Service
description: Validates, posts and settles customer payments.
technology: Java, Spring Boot
relationships:
- to: payments-db
description: Stores payment state in
technology: JDBC
- to: core:mainframe
description: Posts payments to the ledger in
technology: XML/HTTPS
- to: card-gateway
description: Settles card payments through
technology: ISO 8583

The description reads as a sentence from consumer to provider: “Payments Service posts payments to the ledger in Mainframe”. technology says how: a protocol, a driver, a format.

A Relationship always points from what depends to what is depended on. That is what makes impact questions answerable: everything upstream of the mainframe depends on it, and an outage there reaches all of it.

A Person is only ever a consumer: it uses Systems, and nothing depends on it. Pointing a Relationship at a Person is an error:

shop/model.yaml · fails check: person-as-provider
people:
shopper:
name: Shopper
services:
web:
name: Web
relationships:
- to: shopper
description: Shows the basket to

archidocs check reports person-as-provider. Declare it the other way round, under the Person. An Element also can’t depend on itself, its parent or its child (ancestor-descendant-relationship).

Declare a Relationship at the most detailed level you know. If the code shows which Component calls which, declare it between those Components; if not, between the Services. Big Bank’s API Application declares its dependencies on its Components:

digital/model.yaml
api:
name: API Application
description: Internet banking over a JSON/HTTPS API.
technology: Java, Spring Boot
components:
sign-in-controller:
name: Sign In Controller
technology: Spring MVC REST controller
relationships:
- to: security-component
description: Validates sessions with
accounts-summary-controller:
name: Accounts Summary Controller
technology: Spring MVC REST controller
relationships:
- to: mainframe-facade
description: Reads account summaries through
payments-controller:
name: Payments Controller
technology: Spring MVC REST controller
relationships:
- to: security-component
description: Checks step-up authentication with
- to: payments:payments-service
description: Submits payments to
technology: JSON/HTTPS
security-component:
name: Security Component
description: Session handling and token validation.
technology: Spring Security
relationships:
- to: identity:auth-service
description: Validates tokens with
technology: OpenID Connect
- to: database
description: Stores sessions in
technology: JDBC
mainframe-facade:
name: Mainframe Banking System Facade
description: The one place that knows the mainframe's contract.
technology: Spring Bean
relationships:
- to: core:mainframe
description: Reads accounts and transactions from
technology: XML/HTTPS

Edges between higher-level Elements are derived from these and never declared: because the Mainframe Banking System Facade calls core:mainframe, the C2 Landscape draws an edge from API Application to Mainframe, and the C1 Landscape one from Internet Banking System to Mainframe Banking System. Declaring the same edge again at a higher level would only let the two drift apart.

Each Project declares only its own outbound Relationships, so each Team writes down what it depends on and nobody edits another Team’s files to add an inbound one. Name a provider in another Project by its Qualified id, as core:mainframe above.

A Relationship is interaction: sync by default: a call that waits for an answer. An event that goes through a message broker is async, and is declared by the Subscriber, pointing to the Publisher whose events it depends on, with via naming the broker Service and channel the topic or queue:

payments/model.yaml
fraud-detection:
name: Fraud Detection
description: Scores each payment for fraud and holds suspicious ones.
technology: Python
relationships:
- to: payments-service
description: Scores each initiated payment
interaction: async
via: platform:kafka
channel: payments.initiated

Fraud Detection depends on Payments Service’s payments.initiated events, carried by the Platform Team’s Kafka. Impact and path questions count the broker as a hop, and as a dependency of both sides. An async Relationship with no broker, such as a webhook, leaves out via.

When a consumer depends on the same provider in two ways, such as reading over HTTPS and subscribing to events, give each Relationship an id, unique in the Project (duplicate-relationship-id), so Dynamic View Steps and agents can tell them apart.