System context (Structurizr)

Structurizr's whole idea is that you describe the model once and then declare views. Change a relationship and every view showing it updates.


#What this example shows

  • A model block containing people, systems and containers.

  • Relationships declared once, in the model.

  • Two views over the same model.


#A worked example

Open it, edit it, or copy the source below.

System context (Structurizr)

The source, which you can paste into a new diagram and edit:

workspace "Order platform" {
  model {
    customer = person "Customer" "Places and tracks orders"
    agent = person "Support agent" "Handles queries and refunds"

    orders = softwareSystem "Order platform" {
      web = container "Web application" "Storefront" "React"
      api = container "Order API" "Order lifecycle" "Node.js"
      worker = container "Fulfilment worker" "Async jobs" "Node.js"
      db = container "Order database" "Orders and customers" "PostgreSQL"
      queue = container "Job queue" "Fulfilment jobs" "Redis Streams"
    }

    payments = softwareSystem "Payment provider" "External"
    warehouse = softwareSystem "Warehouse system" "External"

    customer -> web "Browses and orders" "HTTPS"
    agent -> web "Handles queries" "HTTPS"
    web -> api "Calls" "JSON/HTTPS"
    api -> db "Reads and writes" "SQL"
    api -> queue "Enqueues jobs"
    api -> payments "Charges cards" "HTTPS"
    worker -> queue "Consumes jobs"
    worker -> db "Reads and writes" "SQL"
    worker -> warehouse "Sends fulfilment" "SFTP"
  }

  views {
    systemContext orders "Context" {
      include *
      autolayout lr
    }
    container orders "Containers" {
      include *
      autolayout lr
    }
  }
}

#Making it your own

  • Declare relationships once, in the model, never per view. That is the benefit.

  • A view with no include shows nothing; include * is the usual start.

  • For a single diagram, C4-PlantUML is less setup for the same picture.



Specialists. Borrow one when you need it.