Architecture Diagrams Catalog

Pick the diagram that answers your question, then draw it the same way every time.

Which software architecture diagram to draw, when to draw it, and how. It covers the C4 model's levels plus the other diagrams software architecture work needs. Each entry says when to use it, how to draw it, and shows a live example with Mermaid source to copy.

For agents: catalog.md (this page as Markdown) and llms.txt.

Start from your question

If you are askingDraw
What systems do we have, and how do they depend on each other?AD06 System landscape
Who uses this system, and what does it talk to?AD01 System context
What does this one application lean on, among everything around it?AD07 Application context
What are the deployable parts of this system, and how do they talk?AD02 Container
If I change this part, what else is affected?AD15 Internal dependency map
How is this one container organised inside?AD03 Component
How are the types in this component shaped?AD04 Code
What do we store, and how do the records relate?AD05 Entity relationship
Where does this data come in, where does it rest, and where does it leave?AD08 Data flow
Which contracts does this system offer and depend on?AD09 Interfaces and services
How does one use case move through the system?AD10 Scenario
In what exact order do these parts call each other?AD11 Sequence
What can happen to this thing next?AD12 State
Where does each part run?AD13 Deployment
How do we build, release, watch, and recover it?AD14 Operations

At a glance

FamilyIdArchetypeStatus
StructureAD06System landscapeActive
StructureAD01System contextActive
StructureAD07Application contextActive
StructureAD02ContainerActive
StructureAD15Internal dependency mapActive
StructureAD03ComponentActive
StructureAD04CodeActive
DataAD05Entity relationshipActive
DataAD08Data flowActive
IntegrationAD09Interfaces and servicesActive
BehaviourAD10ScenarioActive
BehaviourAD11SequenceActive
BehaviourAD12StateActive
OperationsAD13DeploymentActive
OperationsAD14OperationsActive

Visual language

These rules apply to every diagram below. They are the standard; the drawing tool is not.

Around every diagram

Title block

Put these on the diagram or in the caption right above or below it.

FieldWhat goes in it
TitleNames the archetype and the scope: "Container: ticketing system".
ScopeOne line on what is in and what is deliberately left out.
StatusDraft, Review, Final, or Retired.
Version and dateBump the version when the meaning changes, not for layout tweaks.
AuthorWho to ask.
SourceA link to the editable source (the Mermaid text, or the draw.io file next to its exports).

Companion tables

TableColumnsWhen
Relationship tableSource, Target, Intent, Protocol or technology, NotesWhen arrows need more than 2 to 6 words. Keep the arrow label short; put the detail here.
Element inventoryElement, Description, Notes (dependencies, owners, links)Beside every diagram that will be maintained. It is searchable when the picture is not, and it is the list reviewers check against.

Choosing a tool

ToolUse it for
MermaidSmall diagrams (up to about 12 elements), text kept in version control next to the docs, pages that render Mermaid natively.
Graphviz (DOT)Dense graphs where automatic layout and ranking matter more than hand placement.
draw.ioLarge or hand-arranged diagrams, and diagrams people who do not write code will edit. Keep the .drawio source next to its SVG or PNG export.

Structure

What the parts are and how they connect, zooming in one C4 level at a time.

AD06 System landscape

Structure · C4 supplementary · Mermaid flowchart · Active

Use when

You need the big picture of an organisation: all its systems, who uses each one, and how they depend on each other. Good for onboarding and portfolio planning.

Draw it

  • One box per software system, no containers inside.
  • People as person icons on the edge, grouped by role.
  • One labelled boundary for the organisation; systems outside it are [External].
  • Arrows only for real dependencies, each labelled with its purpose.

Scope

In: Every system in the organisation, its user groups, the outside systems it relies on.
Out: Anything inside a system: containers, components, infrastructure.

Check it

  • Every system appears once, as one box.
  • The organisation boundary is drawn and labelled.
  • Every dependency arrow has a purpose label.

Example

---
title: "Landscape: events company"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  finance@{ icon: "fa:user", form: "circle", label: "Finance team", pos: "b", h: 48 }
  subgraph org["Events company [Organisation boundary]"]
    ticketing["Ticketing system<br/><i>[Software system]</i><br/>Sells and checks tickets"]
    venue["Venue system<br/><i>[Software system]</i><br/>Rooms, seating, and capacity"]
    ledger["Finance system<br/><i>[Software system]</i><br/>Accounts and payouts"]
  end
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Buys tickets" --> ticketing
  staff -- "Runs sales and refunds" --> ticketing
  finance -- "Reconciles sales" --> ledger
  ticketing -- "Reads seating plans" --> venue
  ticketing -- "Posts daily sales" --> ledger
  ticketing -- "Takes card payments" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext
Mermaid source
---
title: "Landscape: events company"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  finance@{ icon: "fa:user", form: "circle", label: "Finance team", pos: "b", h: 48 }
  subgraph org["Events company [Organisation boundary]"]
    ticketing["Ticketing system<br/><i>[Software system]</i><br/>Sells and checks tickets"]
    venue["Venue system<br/><i>[Software system]</i><br/>Rooms, seating, and capacity"]
    ledger["Finance system<br/><i>[Software system]</i><br/>Accounts and payouts"]
  end
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Buys tickets" --> ticketing
  staff -- "Runs sales and refunds" --> ticketing
  finance -- "Reconciles sales" --> ledger
  ticketing -- "Reads seating plans" --> venue
  ticketing -- "Posts daily sales" --> ledger
  ticketing -- "Takes card payments" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext

AD01 System context

Structure · C4 level 1 · Mermaid flowchart · Active

Use when

Showing who uses one system and which other systems it talks to. Start here: it is the diagram everyone, technical or not, can read.

Draw it

  • The system in focus is one box in the middle.
  • Its users as person icons, its neighbours as boxes marked [External system] where they are.
  • No technology choices, containers, or protocols beyond what a non-technical reader needs.
  • Each arrow names the purpose: "Buys tickets", not "HTTPS".

Scope

In: One system in focus, the people who use it, the outside systems it connects to.
Out: Containers, components, technology choices, infrastructure.

Check it

  • Exactly one system in focus.
  • Every person and outside system has a one-line role or responsibility.
  • No container or component detail.
  • Every arrow names an intent a non-technical reader understands.

Example

---
title: "System context: ticketing system"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  ticketing["Ticketing system<br/><i>[Software system]</i><br/>Sells tickets and checks them at the door"]
  payments["Payment provider<br/><i>[External system]</i>"]
  email["Email service<br/><i>[External system]</i>"]
  attendee -- "Buys tickets, shows them at the door" --> ticketing
  staff -- "Sets up events, issues refunds" --> ticketing
  ticketing -- "Takes card payments" --> payments
  ticketing -- "Sends receipts and tickets" --> email
  classDef ext stroke-dasharray: 5 5
  class payments,email ext
Mermaid source
---
title: "System context: ticketing system"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  ticketing["Ticketing system<br/><i>[Software system]</i><br/>Sells tickets and checks them at the door"]
  payments["Payment provider<br/><i>[External system]</i>"]
  email["Email service<br/><i>[External system]</i>"]
  attendee -- "Buys tickets, shows them at the door" --> ticketing
  staff -- "Sets up events, issues refunds" --> ticketing
  ticketing -- "Takes card payments" --> payments
  ticketing -- "Sends receipts and tickets" --> email
  classDef ext stroke-dasharray: 5 5
  class payments,email ext

AD07 Application context

Structure · Between C4 levels 1 and 2 · Mermaid flowchart · Active

Use when

One application lives among many in a larger estate and you need to show its neighbours: the shared services it leans on (sign-in, notifications, reporting) and the sibling applications it trades data with. It looks outward. To look inward at what a change will affect, use AD15 Internal dependency map.

Draw it

  • The application in focus in the middle; everything else at the same level of detail.
  • Shared platform services in their own labelled group, so the reader sees what is reused rather than owned.
  • Users as person icons, only those who use this application.
  • Arrows name the data or service exchanged.

Scope

In: One application, the shared services it uses, the sibling applications it exchanges data with, its users.
Out: The application's internals and anything it does not touch.

Check it

  • Shared services are grouped and labelled as shared.
  • Sibling applications are marked as siblings, not as outside systems.
  • Every arrow names the data or service exchanged.

Example

---
title: "Application context: box office app"
---
flowchart LR
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  app["Box office app<br/><i>[Application in focus]</i><br/>Sales, refunds, door scanning"]
  subgraph shared["Shared services [Platform]"]
    sso["Sign-in service<br/><i>[Shared service]</i>"]
    notify["Notification service<br/><i>[Shared service]</i>"]
    reports["Reporting warehouse<br/><i>[Shared service]</i>"]
  end
  web["Web shop<br/><i>[Sibling application]</i>"]
  ledger["Finance system<br/><i>[Sibling application]</i>"]
  staff -- "Sells, refunds, scans" --> app
  app -- "Signs staff in" --> sso
  app -- "Sends refund notices" --> notify
  app -- "Exports nightly sales" --> reports
  app -- "Shares seat holds" --> web
  app -- "Posts refunds" --> ledger
Mermaid source
---
title: "Application context: box office app"
---
flowchart LR
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  app["Box office app<br/><i>[Application in focus]</i><br/>Sales, refunds, door scanning"]
  subgraph shared["Shared services [Platform]"]
    sso["Sign-in service<br/><i>[Shared service]</i>"]
    notify["Notification service<br/><i>[Shared service]</i>"]
    reports["Reporting warehouse<br/><i>[Shared service]</i>"]
  end
  web["Web shop<br/><i>[Sibling application]</i>"]
  ledger["Finance system<br/><i>[Sibling application]</i>"]
  staff -- "Sells, refunds, scans" --> app
  app -- "Signs staff in" --> sso
  app -- "Sends refund notices" --> notify
  app -- "Exports nightly sales" --> reports
  app -- "Shares seat holds" --> web
  app -- "Posts refunds" --> ledger

AD02 Container

Structure · C4 level 2 · Mermaid flowchart · Active

Use when

Showing the separately deployable or runnable parts of one system (apps, services, databases, queues) and how they talk. The workhorse diagram for technical design.

Draw it

  • A labelled boundary for the system; its containers inside, each with [Container: technology].
  • Data stores as cylinders.
  • Users and external systems outside the boundary, the same ones as the system context.
  • Arrows name the purpose and the protocol: "Calls (JSON/HTTPS)".

Scope

In: The containers inside one system boundary, the people and outside systems that touch them, and the main technology of each.
Out: Components and classes; where things run (that is AD13 Deployment).

Check it

  • The system boundary is drawn.
  • Every container states its technology.
  • Data stores are cylinders.
  • No component detail and no hosting topology.

Example

---
title: "Container: ticketing system"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  subgraph sys["Ticketing system [System boundary]"]
    web["Web shop<br/><i>[Container: single-page app]</i><br/>Browse events, buy tickets"]
    admin["Box office app<br/><i>[Container: web app]</i><br/>Sales, refunds, scanning"]
    api["Ticketing API<br/><i>[Container: REST service]</i><br/>Orders, pricing, tickets"]
    db[("Ticket database<br/><i>[Container: PostgreSQL]</i>")]
  end
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Uses (HTTPS)" --> web
  staff -- "Uses (HTTPS)" --> admin
  web -- "Calls (JSON/HTTPS)" --> api
  admin -- "Calls (JSON/HTTPS)" --> api
  api -- "Reads and writes (SQL)" --> db
  api -- "Takes payments (HTTPS)" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext
Mermaid source
---
title: "Container: ticketing system"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  staff@{ icon: "fa:user", form: "circle", label: "Box office staff", pos: "b", h: 48 }
  subgraph sys["Ticketing system [System boundary]"]
    web["Web shop<br/><i>[Container: single-page app]</i><br/>Browse events, buy tickets"]
    admin["Box office app<br/><i>[Container: web app]</i><br/>Sales, refunds, scanning"]
    api["Ticketing API<br/><i>[Container: REST service]</i><br/>Orders, pricing, tickets"]
    db[("Ticket database<br/><i>[Container: PostgreSQL]</i>")]
  end
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Uses (HTTPS)" --> web
  staff -- "Uses (HTTPS)" --> admin
  web -- "Calls (JSON/HTTPS)" --> api
  admin -- "Calls (JSON/HTTPS)" --> api
  api -- "Reads and writes (SQL)" --> db
  api -- "Takes payments (HTTPS)" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext

AD15 Internal dependency map

Structure · Supplementary, alongside C4 level 2 · Mermaid flowchart · Active

Use when

You are about to change one part of a system and need to know what else moves: which internal parts depend on it for data, which it triggers or is triggered by, and what to retest. Also good for planning a refactor or a split.

Draw it

  • The internal parts of one system (containers, jobs, queues, stores) at one level of detail.
  • Prefix every arrow with what kind of dependency it is: "data:" for information passed or read, "control:" for triggers, schedules, and commands.
  • Mark the part being changed [Changing] and each part it reaches [Impacted], in words as well as any highlight.
  • Leave out parts the change cannot reach; say so in the scope line.

Scope

In: The internal parts of one system that the change can reach, and the data and control dependencies between them.
Out: Parts the change cannot reach, outside systems unless they depend on the changed part, and code-level detail.

Check it

  • The changed part is marked [Changing] in words.
  • Every reached part is marked [Impacted] in words.
  • Every arrow starts with "data:" or "control:".
  • Each impacted part has a retest or owner noted in the companion table.

Example

---
title: "Internal dependency map: changing pricing rules"
---
flowchart TB
  rules[("Price rules table<br/><i>[Store] [Changing]</i>")]
  api["Ticketing API<br/><i>[Container] [Impacted]</i>"]
  queue["Order events<br/><i>[Queue]</i>"]
  nightly["Nightly sales export<br/><i>[Scheduled job] [Impacted]</i>"]
  web["Web shop<br/><i>[Container] [Impacted]</i>"]
  admin["Box office app<br/><i>[Container] [Impacted]</i>"]
  web -- "data: shows prices from" --> api
  api -- "data: reads price rules" --> rules
  api -- "control: publishes order placed" --> queue
  queue -- "control: triggers re-total" --> nightly
  nightly -- "data: reads price rules" --> rules
  admin -- "data: sells at prices from" --> api
  classDef changing stroke-width:4px
  classDef impacted stroke-width:2px
  class rules changing
  class api,nightly,web,admin impacted
Mermaid source
---
title: "Internal dependency map: changing pricing rules"
---
flowchart TB
  rules[("Price rules table<br/><i>[Store] [Changing]</i>")]
  api["Ticketing API<br/><i>[Container] [Impacted]</i>"]
  queue["Order events<br/><i>[Queue]</i>"]
  nightly["Nightly sales export<br/><i>[Scheduled job] [Impacted]</i>"]
  web["Web shop<br/><i>[Container] [Impacted]</i>"]
  admin["Box office app<br/><i>[Container] [Impacted]</i>"]
  web -- "data: shows prices from" --> api
  api -- "data: reads price rules" --> rules
  api -- "control: publishes order placed" --> queue
  queue -- "control: triggers re-total" --> nightly
  nightly -- "data: reads price rules" --> rules
  admin -- "data: sells at prices from" --> api
  classDef changing stroke-width:4px
  classDef impacted stroke-width:2px
  class rules changing
  class api,nightly,web,admin impacted

AD03 Component

Structure · C4 level 3 · Mermaid flowchart · Active

Use when

Showing the main building blocks inside one container and what each is responsible for. Draw it when a container is complex enough that people argue about where code belongs.

Draw it

  • A labelled boundary for the one container; its components inside with [Component: kind].
  • Only the components that matter to the decision at hand, not every class.
  • Neighbouring containers and external systems outside the boundary.
  • Arrows name what is asked of the component.

Scope

In: The components inside one container, how they collaborate, and the neighbouring containers they call.
Out: Classes, methods, and implementation logic.

Check it

  • The container boundary is drawn.
  • Each component has a responsibility, not just a name.
  • No class-level detail.

Example

---
title: "Component: ticketing API"
---
flowchart TB
  web["Web shop<br/><i>[Container]</i>"]
  subgraph api["Ticketing API [Container boundary]"]
    orders["Orders endpoint<br/><i>[Component: controller]</i>"]
    pricing["Pricing<br/><i>[Component: domain service]</i><br/>Applies price rules"]
    issuer["Ticket issuer<br/><i>[Component: domain service]</i><br/>Creates signed QR tickets"]
    gateway["Payment adapter<br/><i>[Component: adapter]</i>"]
    repo["Order store<br/><i>[Component: repository]</i>"]
  end
  db[("Ticket database<br/><i>[Container]</i>")]
  payments["Payment provider<br/><i>[External system]</i>"]
  web -- "Places order (JSON/HTTPS)" --> orders
  orders -- "Gets price" --> pricing
  orders -- "Charges card" --> gateway
  orders -- "Issues tickets" --> issuer
  orders -- "Saves order" --> repo
  repo -- "Reads and writes (SQL)" --> db
  gateway -- "Charges (HTTPS)" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext
Mermaid source
---
title: "Component: ticketing API"
---
flowchart TB
  web["Web shop<br/><i>[Container]</i>"]
  subgraph api["Ticketing API [Container boundary]"]
    orders["Orders endpoint<br/><i>[Component: controller]</i>"]
    pricing["Pricing<br/><i>[Component: domain service]</i><br/>Applies price rules"]
    issuer["Ticket issuer<br/><i>[Component: domain service]</i><br/>Creates signed QR tickets"]
    gateway["Payment adapter<br/><i>[Component: adapter]</i>"]
    repo["Order store<br/><i>[Component: repository]</i>"]
  end
  db[("Ticket database<br/><i>[Container]</i>")]
  payments["Payment provider<br/><i>[External system]</i>"]
  web -- "Places order (JSON/HTTPS)" --> orders
  orders -- "Gets price" --> pricing
  orders -- "Charges card" --> gateway
  orders -- "Issues tickets" --> issuer
  orders -- "Saves order" --> repo
  repo -- "Reads and writes (SQL)" --> db
  gateway -- "Charges (HTTPS)" --> payments
  classDef ext stroke-dasharray: 5 5
  class payments ext

AD04 Code

Structure · C4 level 4 · Mermaid classDiagram · Active

Use when

Showing the types inside one component and how they relate. Draw it only when it earns its place, such as a tricky domain model; most code-level diagrams go stale fast and an IDE can generate them.

Draw it

  • One component's types only.
  • Show the fields and methods that explain the design; leave out getters and plumbing.
  • Name relationships with multiplicity: "1 order has 1..* tickets".

Scope

In: The types of one component that explain the design.
Out: Every other type, getters, framework plumbing.

Check it

  • Only types that explain the design are shown.
  • Every relationship has a multiplicity and a verb.
  • Someone will keep it current, or it is generated.

Example

---
title: "Code: ordering model"
---
classDiagram
  class Order {
    +OrderId id
    +Status status
    +Money total()
    +confirm(PaymentRef ref)
  }
  class Ticket {
    +TicketId id
    +Seat seat
    +String qrCode
  }
  class PriceRule {
    <<interface>>
    +Money apply(Money base)
  }
  class EarlyBird
  Order "1" *-- "1..*" Ticket : contains
  Order ..> PriceRule : priced by
  PriceRule <|.. EarlyBird
Mermaid source
---
title: "Code: ordering model"
---
classDiagram
  class Order {
    +OrderId id
    +Status status
    +Money total()
    +confirm(PaymentRef ref)
  }
  class Ticket {
    +TicketId id
    +Seat seat
    +String qrCode
  }
  class PriceRule {
    <<interface>>
    +Money apply(Money base)
  }
  class EarlyBird
  Order "1" *-- "1..*" Ticket : contains
  Order ..> PriceRule : priced by
  PriceRule <|.. EarlyBird

Data

What is stored and how information moves.

AD05 Entity relationship

Data · Supplementary · Mermaid erDiagram · Active

Use when

Showing what is stored: the entities, their key fields, and how they relate. Use it for schema design and for agreeing on the meaning of words with domain experts.

Draw it

  • One box per entity, named as the business names it.
  • Only key and meaningful fields; mark PK and FK.
  • Each relationship has crow's-foot cardinality and a verb label: "places", "holds".

Scope

In: The entities in one data store or one domain, their key fields, their relationships.
Out: Indexes, storage tuning, every column.

Check it

  • Entity names match the words the business uses.
  • Keys are marked.
  • Every relationship has cardinality and a verb.

Example

---
title: "Entity relationship: ticketing"
---
erDiagram
  ATTENDEE ||--o{ ORDER : places
  ORDER ||--|{ TICKET : contains
  EVENT ||--|{ TICKET_TYPE : offers
  TICKET_TYPE ||--o{ TICKET : "is sold as"
  ATTENDEE {
    uuid id PK
    string email
  }
  ORDER {
    uuid id PK
    uuid attendee_id FK
    string status
  }
  TICKET {
    uuid id PK
    uuid order_id FK
    uuid ticket_type_id FK
    string seat
  }
Mermaid source
---
title: "Entity relationship: ticketing"
---
erDiagram
  ATTENDEE ||--o{ ORDER : places
  ORDER ||--|{ TICKET : contains
  EVENT ||--|{ TICKET_TYPE : offers
  TICKET_TYPE ||--o{ TICKET : "is sold as"
  ATTENDEE {
    uuid id PK
    string email
  }
  ORDER {
    uuid id PK
    uuid attendee_id FK
    string status
  }
  TICKET {
    uuid id PK
    uuid order_id FK
    uuid ticket_type_id FK
    string seat
  }

AD08 Data flow

Data · Supplementary · Mermaid flowchart · Active

Use when

Showing how information moves: where it enters, which processes change it, where it rests, and where it leaves. Use it for privacy reviews, threat modelling, and integration design.

Draw it

  • People and outside parties at the edges, as person icons or [External] boxes.
  • Processes as rounded boxes named with a verb: "Take payment".
  • Data stores as cylinders.
  • Every arrow names the data it carries, not the call: "card details", "order".
  • Trust boundaries as labelled groups.

Scope

In: Entry and exit points, the processes that change data, stores, trust boundaries, the controls at each boundary.
Out: Screens and business rules that do not change how data is handled.

Check it

  • Every entry and exit point is shown.
  • Every trust boundary is labelled and its controls (encryption, access check, logging) are named at the crossing.
  • Privileged paths (admin, staff) are drawn separately from ordinary user paths, and labelled as such.
  • Sensitive data is named as sensitive in words.
  • Volumes are noted where they matter.

Example

---
title: "Data flow: buying a ticket"
---
flowchart LR
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  subgraph trust["Ticketing system [Trust boundary]"]
    take("Take order")
    pay("Take payment")
    issue("Issue tickets")
    orders[("Orders store")]
  end
  provider["Payment provider<br/><i>[External system]</i>"]
  attendee -- "seat choice, email" --> take
  take -- "order" --> orders
  attendee -- "card details" --> pay
  pay -- "card details" --> provider
  provider -- "payment result" --> pay
  pay -- "paid order" --> issue
  issue -- "QR tickets" --> attendee
  classDef ext stroke-dasharray: 5 5
  class provider ext
Mermaid source
---
title: "Data flow: buying a ticket"
---
flowchart LR
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  subgraph trust["Ticketing system [Trust boundary]"]
    take("Take order")
    pay("Take payment")
    issue("Issue tickets")
    orders[("Orders store")]
  end
  provider["Payment provider<br/><i>[External system]</i>"]
  attendee -- "seat choice, email" --> take
  take -- "order" --> orders
  attendee -- "card details" --> pay
  pay -- "card details" --> provider
  provider -- "payment result" --> pay
  pay -- "paid order" --> issue
  issue -- "QR tickets" --> attendee
  classDef ext stroke-dasharray: 5 5
  class provider ext

Integration

The promises systems make to each other.

AD09 Interfaces and services

Integration · Supplementary · Mermaid flowchart · Active

Use when

Showing the contracts between systems: which interfaces each one provides, which it needs, and who consumes them. Use it to plan versioning, ownership, and the impact of an interface change.

Draw it

  • Systems or containers as boxes; each interface as a circle named with its style and version: "Orders API, REST v2".
  • Arrows say "provides", "requires", "publishes" or "subscribes".
  • Mark external interfaces [External] in the label.

Scope

In: Interfaces (APIs, topics, files, shared databases) provided and required, their consumers, and their style and version.
Out: Internal components behind the interface.

Check it

  • Every interface has a name, a style, and a version.
  • Every provider and consumer is shown.
  • Sign-in and authorisation for each interface are noted or linked.
  • A legend explains any shape or styling.

Example

---
title: "Interfaces: ticketing API"
---
flowchart LR
  api["Ticketing API<br/><i>[Container]</i>"]
  ordersApi(("Orders API<br/>REST v2"))
  events(("Ticket events<br/>message topic"))
  payApi(("Payments API<br/>REST, [External]"))
  web["Web shop<br/><i>[Container]</i>"]
  ledger["Finance system<br/><i>[Software system]</i>"]
  provider["Payment provider<br/><i>[External system]</i>"]
  api -- "provides" --> ordersApi
  api -- "publishes" --> events
  web -- "requires" --> ordersApi
  ledger -- "subscribes" --> events
  provider -- "provides" --> payApi
  api -- "requires" --> payApi
  classDef ext stroke-dasharray: 5 5
  class provider,payApi ext
Mermaid source
---
title: "Interfaces: ticketing API"
---
flowchart LR
  api["Ticketing API<br/><i>[Container]</i>"]
  ordersApi(("Orders API<br/>REST v2"))
  events(("Ticket events<br/>message topic"))
  payApi(("Payments API<br/>REST, [External]"))
  web["Web shop<br/><i>[Container]</i>"]
  ledger["Finance system<br/><i>[Software system]</i>"]
  provider["Payment provider<br/><i>[External system]</i>"]
  api -- "provides" --> ordersApi
  api -- "publishes" --> events
  web -- "requires" --> ordersApi
  ledger -- "subscribes" --> events
  provider -- "provides" --> payApi
  api -- "requires" --> payApi
  classDef ext stroke-dasharray: 5 5
  class provider,payApi ext

Behaviour

What happens over time.

AD10 Scenario

Behaviour · C4 dynamic · Mermaid flowchart · Active

Use when

Walking through one use case on top of the structure diagrams: the same boxes, with numbered steps. Use it when the order matters but a full sequence diagram would be too much.

Draw it

  • Reuse the boxes and names from the container or component diagram.
  • Number each arrow in order: "Step 1: Places order".
  • One scenario per diagram; its title names it.

Scope

In: One use case: the people and parts it touches, in numbered order, plus its main exception path.
Out: Every other use case.

Check it

  • One use case per diagram, named in the title.
  • Steps are numbered and unambiguous.
  • The main exception or decision path is shown or linked.
  • Scenarios that should become integration or acceptance tests are marked as test candidates.

Example

---
title: "Scenario: attendee buys a ticket"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  web["Web shop<br/><i>[Container]</i>"]
  api["Ticketing API<br/><i>[Container]</i>"]
  db[("Ticket database<br/><i>[Container]</i>")]
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Step 1: Chooses seats and pays" --> web
  web -- "Step 2: Places order" --> api
  api -- "Step 3: Charges card" --> payments
  api -- "Step 4: Saves order and tickets" --> db
  web -- "Step 5: Shows QR tickets" --> attendee
  classDef ext stroke-dasharray: 5 5
  class payments ext
Mermaid source
---
title: "Scenario: attendee buys a ticket"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  web["Web shop<br/><i>[Container]</i>"]
  api["Ticketing API<br/><i>[Container]</i>"]
  db[("Ticket database<br/><i>[Container]</i>")]
  payments["Payment provider<br/><i>[External system]</i>"]
  attendee -- "Step 1: Chooses seats and pays" --> web
  web -- "Step 2: Places order" --> api
  api -- "Step 3: Charges card" --> payments
  api -- "Step 4: Saves order and tickets" --> db
  web -- "Step 5: Shows QR tickets" --> attendee
  classDef ext stroke-dasharray: 5 5
  class payments ext

AD11 Sequence

Behaviour · Supplementary · Mermaid sequenceDiagram · Active

Use when

Showing the exact order of calls and replies between parts, including waits, errors, and retries. Use it for API design, timing problems, and debugging.

Draw it

  • People as actors (Mermaid draws a stick figure), systems as participants.
  • Solid arrows for requests, dashed arrows for replies; each names the message.
  • Show the unhappy path with alt or opt blocks, not a second diagram.

Scope

In: The calls and replies for one interaction, including errors, waits, and retries.
Out: Unrelated interactions and internal logic of each participant.

Check it

  • Every message is named.
  • The unhappy path is in an alt or opt block.
  • People are actors, not participant boxes.

Example

---
title: "Sequence: buy a ticket"
---
sequenceDiagram
  actor A as Attendee
  participant W as Web shop
  participant API as Ticketing API
  participant P as Payment provider [External]
  A->>W: Choose seats and pay
  W->>API: POST /orders
  API->>P: Charge card
  alt card approved
    P-->>API: Approved
    API-->>W: 201 Created, tickets
    W-->>A: Shows QR tickets
  else card declined
    P-->>API: Declined
    API-->>W: 402 Payment required
    W-->>A: Asks for another card
  end
Mermaid source
---
title: "Sequence: buy a ticket"
---
sequenceDiagram
  actor A as Attendee
  participant W as Web shop
  participant API as Ticketing API
  participant P as Payment provider [External]
  A->>W: Choose seats and pay
  W->>API: POST /orders
  API->>P: Charge card
  alt card approved
    P-->>API: Approved
    API-->>W: 201 Created, tickets
    W-->>A: Shows QR tickets
  else card declined
    P-->>API: Declined
    API-->>W: 402 Payment required
    W-->>A: Asks for another card
  end

AD12 State

Behaviour · Supplementary · Mermaid stateDiagram-v2 · Active

Use when

Showing the life cycle of one thing (an order, a ticket, a case) and the events that move it between states. Use it whenever someone asks "what can happen to it next?".

Draw it

  • One diagram per thing; states named as adjectives or past participles: "Paid".
  • Each transition names the event that causes it.
  • Mark the start and every end state.

Scope

In: The states of one thing and the events that move it between them.
Out: Other things' states, how events are implemented.

Check it

  • There is a start and every end state is marked.
  • Every transition names its event.
  • No state is unreachable.

Example

---
title: "State: ticket"
---
stateDiagram-v2
  [*] --> Reserved : seats chosen
  Reserved --> Paid : payment approved
  Reserved --> Expired : 15 minutes pass
  Paid --> Scanned : scanned at door
  Paid --> Refunded : refund issued
  Scanned --> [*]
  Expired --> [*]
  Refunded --> [*]
Mermaid source
---
title: "State: ticket"
---
stateDiagram-v2
  [*] --> Reserved : seats chosen
  Reserved --> Paid : payment approved
  Reserved --> Expired : 15 minutes pass
  Paid --> Scanned : scanned at door
  Paid --> Refunded : refund issued
  Scanned --> [*]
  Expired --> [*]
  Refunded --> [*]

Operations

Where it runs and how people keep it running.

AD13 Deployment

Operations · C4 deployment · Mermaid flowchart · Active

Use when

Showing where the containers run: environments, regions, hosts, managed services, and the network paths between them. Use it for hosting decisions, capacity, and failover planning.

Draw it

  • Nested labelled groups for the infrastructure: [Environment], [Region], [Node].
  • Containers inside the node that runs them, with instance counts: "x2".
  • Arrows name the protocol and port when it matters.
  • One environment per diagram, named in the title.

Scope

In: One environment: its nodes, regions, and managed services, which containers run where, instance counts, and network paths.
Out: Business logic, components, and other environments.

Check it

  • One environment per diagram, named in the title.
  • Major runtime and framework versions are stated.
  • The names of the settings and secrets each part needs are listed in the companion table, never their values.
  • Nodes match real infrastructure boundaries.
  • Scaling and failover are shown where they exist.

Example

---
title: "Deployment: production"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  subgraph prod["Production [Environment]"]
    subgraph edge["CDN [Edge network]"]
      web["Web shop files<br/><i>[Static site]</i>"]
    end
    subgraph region["US West [Cloud region]"]
      subgraph app["App service [Node]"]
        api["Ticketing API x2<br/><i>[Container]</i>"]
      end
      subgraph data["Managed database [Node]"]
        db[("PostgreSQL primary + standby")]
      end
    end
  end
  attendee -- "HTTPS 443" --> web
  web -- "JSON/HTTPS 443" --> api
  api -- "SQL over TLS 5432" --> db
Mermaid source
---
title: "Deployment: production"
---
flowchart TB
  attendee@{ icon: "fa:user", form: "circle", label: "Attendee", pos: "b", h: 48 }
  subgraph prod["Production [Environment]"]
    subgraph edge["CDN [Edge network]"]
      web["Web shop files<br/><i>[Static site]</i>"]
    end
    subgraph region["US West [Cloud region]"]
      subgraph app["App service [Node]"]
        api["Ticketing API x2<br/><i>[Container]</i>"]
      end
      subgraph data["Managed database [Node]"]
        db[("PostgreSQL primary + standby")]
      end
    end
  end
  attendee -- "HTTPS 443" --> web
  web -- "JSON/HTTPS 443" --> api
  api -- "SQL over TLS 5432" --> db

AD14 Operations

Operations · Supplementary · Mermaid flowchart · Active

Use when

Showing how people keep the system running: what is monitored, who gets alerted, where the runbooks and backups are, and how a restore happens. Use it for handovers, on-call setup, and reliability reviews.

Draw it

  • The people on call as person icons, with their role.
  • Monitoring, alerting, logs, and backups as boxes; the system itself as one box.
  • Arrows name the check or action and how often: "Health check every minute".

Scope

In: Build and release stages, monitoring, alerting, logs, security scanning, backups, and who is called and how.
Out: Business process and user-facing detail.

Check it

  • Every build and release stage is shown.
  • Monitoring and alerting are visible, with who gets paged.
  • Security scanning and backups appear where they exist.
  • Escalation paths are labelled.

Example

---
title: "Operations: ticketing system"
---
flowchart TB
  oncall@{ icon: "fa:user", form: "circle", label: "On-call engineer", pos: "b", h: 48 }
  sys["Ticketing system<br/><i>[Software system]</i>"]
  monitor["Uptime monitor<br/><i>[External service]</i>"]
  alerts["Alerting<br/><i>[External service]</i>"]
  logs["Log store<br/><i>[Service]</i>"]
  backups[("Backup store<br/><i>[Off-site, write-once]</i>")]
  runbook["Runbook<br/><i>[Document]</i>"]
  monitor -- "Health check every minute" --> sys
  monitor -- "Raises incident" --> alerts
  alerts -- "Pages by phone and email" --> oncall
  sys -- "Ships logs" --> logs
  sys -- "Nightly backup" --> backups
  oncall -- "Follows" --> runbook
  oncall -- "Restores from" --> backups
  classDef ext stroke-dasharray: 5 5
  class monitor,alerts ext
Mermaid source
---
title: "Operations: ticketing system"
---
flowchart TB
  oncall@{ icon: "fa:user", form: "circle", label: "On-call engineer", pos: "b", h: 48 }
  sys["Ticketing system<br/><i>[Software system]</i>"]
  monitor["Uptime monitor<br/><i>[External service]</i>"]
  alerts["Alerting<br/><i>[External service]</i>"]
  logs["Log store<br/><i>[Service]</i>"]
  backups[("Backup store<br/><i>[Off-site, write-once]</i>")]
  runbook["Runbook<br/><i>[Document]</i>"]
  monitor -- "Health check every minute" --> sys
  monitor -- "Raises incident" --> alerts
  alerts -- "Pages by phone and email" --> oncall
  sys -- "Ships logs" --> logs
  sys -- "Nightly backup" --> backups
  oncall -- "Follows" --> runbook
  oncall -- "Restores from" --> backups
  classDef ext stroke-dasharray: 5 5
  class monitor,alerts ext

Quality gate

A diagram is ready to share only when every item passes.

  1. The title names the archetype and the scope.
  2. One abstraction level, or a deliberate, lighter-weight hint of the next level out.
  3. Every element has a name, a kind, and a one-line description; containers, components, and nodes state their technology.
  4. Every person is a person icon.
  5. Every arrow has a direction and an intent label; inter-process arrows name the protocol where it matters.
  6. Acronyms are expanded or well known to the audience.
  7. Nothing relies on colour or line style alone; a legend explains any styling.
  8. Text is readable in both light and dark mode, checked in the real renderer.
  9. No label overlaps a box, a boundary, or another label.
  10. Long boxes are wrapped (about 12 to 24 characters a line) or shortened.
  11. Sans-serif font; no decorative emoji in labels.
  12. The title block is filled in.
  13. Companion tables are present when the diagram will be maintained.
  14. Someone new can read it without a narrator.

Anti-patterns

Not in this catalog

These diagrams are about the person at the screen rather than the system, so they live elsewhere.

DiagramWhere it lives
User journeyUI/UX
Screen flowUI/UX
WireframeUI/UX
Response visuals for chat answersAttention SOPs, "Picture first" catalog