Skip to content

structurizr.fbl

Example document structurizr.fbl

Views generated from the file

This view is drawn by this site from structurizr.fbl itself. It shows the data in the document, not the notation the diagram draws.

Bindings of structurizr.fbl. Flowchart of the bindings in structurizr.fbl: 1 binding(s) (workspace) as boxes with the files they claim and their body's format family, and 3 element rule(s) and 1 relation rule(s) as rounded boxes with the type each produces.
Generated from structurizr.fbl at 4590c56
Diagram as text (Mermaid)
flowchart LR
  accTitle: Bindings of structurizr.fbl
  accDescr: Flowchart of the bindings in structurizr.fbl: 1 binding(s) (workspace) as boxes with the files they claim and their body's format family, and 3 element rule(s) and 1 relation rule(s) as rounded boxes with the type each produces.
  b_workspace["Structurizr DSL workspace<br/>workspace<br/>.dsl, blocks family"]
  e_workspace_person("person<br/>Person")
  b_workspace -->|element| e_workspace_person
  e_workspace_softwareSystem("softwareSystem<br/>SoftwareSystem")
  b_workspace -->|element| e_workspace_softwareSystem
  e_workspace_container("container<br/>Container")
  b_workspace -->|element| e_workspace_container
  r_workspace_relationship(["relationship<br/>Relationship"])
  b_workspace -->|relation| r_workspace_relationship

The file

Download structurizr.fbl (6,547 bytes, unchanged from the source).

{
  "$schema": "https://etalii.net/adp/fbl/schema/0.1/fbl.schema.json#/$defs/Document",
  "fbl": "0.1",
  "doc": "A Structurizr DSL workspace (definitions/diagrams/c4-*.dis, c4-container.md): the blocks family, and one binding shared by six readings. Every C4 specification names 'structurizr.fbl#workspace' as its binding, so a host opens one model and one history per .dsl file however many C4 views of it are open (section 9). Which elements a view shows, and relationships lifted to the nearest drawn ancestor, are the viewpoint's and DISL's; this binding says only how the model is read and written. !include, !script and other directives are unbound statements: kept byte for byte, never followed.",
  "bindings": {
    "workspace": {
      "title": "Structurizr DSL workspace",
      "claims": {
        "extensions": [".dsl"],
        "origins": ["c4/context", "c4/container", "c4/component", "c4/deployment", "c4/dynamic", "c4/system-landscape"]
      },
      "body": { "kind": "file", "family": "blocks" },
      "comment": "^\\s*(#|//)",
      "reader": "declared",
      "text": { "newline": "lf", "indent": 4, "finalNewline": true },
      "registration": {
        "legacyLayout": "{base}.layout.json",
        "createOnFirstPlacement": true
      },
      "blocks": [
        { "name": "workspace", "line": "^workspace(?:\\s+\"[^\"]*\")*\\s*\\{\\s*$", "within": ["^"], "caseInsensitive": true },
        { "name": "model", "line": "^model\\s*\\{\\s*$", "within": ["workspace"], "caseInsensitive": true },
        { "name": "group", "line": "^group\\s+\"[^\"]*\"\\s*\\{\\s*$", "within": ["model", "group", "softwareSystem", "container"], "caseInsensitive": true },
        { "name": "views", "line": "^views\\s*\\{\\s*$", "within": ["workspace"], "caseInsensitive": true },
        {
          "name": "view",
          "line": "^(?:systemContext|container|component|deployment|dynamic|systemLandscape)(?:\\s+(?:\\*|[A-Za-z_][A-Za-z0-9_]*))*(?:\\s+\"(?<environment>[^\"]*)\")?\\s+\"(?<key>[^\"]*)\"\\s*\\{\\s*$",
          "within": ["views"],
          "caseInsensitive": true,
          "view": "key"
        }
      ],
      "elements": [
        {
          "name": "person",
          "type": "Person",
          "line": "^(?:(?<id>[A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*)?person\\s+\"(?<name>[^\"]*)\"(?:\\s+\"(?<description>[^\"]*)\")?(?:\\s+\"(?<tags>[^\"]*)\")?\\s*(?:\\{\\s*)?$",
          "within": ["model", "group"],
          "opens": true,
          "caseInsensitive": true,
          "id": { "from": { "group": "id" } },
          "attributes": {
            "name": { "group": "name", "empty": "refuse" },
            "description": { "group": "description", "empty": "keep" },
            "tags": { "group": "tags", "empty": "keep" }
          },
          "insert": { "place": "after-last", "container": "model", "emit": "{id} = person \"{name}\" \"{description}\"" },
          "remove": { "cascade": ["relationship"] }
        },
        {
          "name": "softwareSystem",
          "type": "SoftwareSystem",
          "line": "^(?:(?<id>[A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*)?softwareSystem\\s+\"(?<name>[^\"]*)\"(?:\\s+\"(?<description>[^\"]*)\")?(?:\\s+\"(?<tags>[^\"]*)\")?\\s*(?:\\{\\s*)?$",
          "within": ["model", "group"],
          "opens": true,
          "caseInsensitive": true,
          "id": { "from": { "group": "id" } },
          "attributes": {
            "name": { "group": "name", "empty": "refuse" },
            "description": { "group": "description", "empty": "keep" },
            "tags": { "group": "tags", "empty": "keep" }
          },
          "insert": { "place": "after-last", "container": "model", "emit": "{id} = softwareSystem \"{name}\" \"{description}\"" },
          "remove": { "cascade": ["container", "relationship"] }
        },
        {
          "name": "container",
          "type": "Container",
          "line": "^(?:(?<id>[A-Za-z_][A-Za-z0-9_]*)\\s*=\\s*)?container\\s+\"(?<name>[^\"]*)\"(?:\\s+\"(?<description>[^\"]*)\")?(?:\\s+\"(?<technology>[^\"]*)\")?(?:\\s+\"(?<tags>[^\"]*)\")?\\s*(?:\\{\\s*)?$",
          "within": ["softwareSystem", "group"],
          "opens": true,
          "caseInsensitive": true,
          "parent": { "rules": ["softwareSystem"], "slot": "containers" },
          "id": { "from": { "group": "id" } },
          "attributes": {
            "name": { "group": "name", "empty": "refuse" },
            "description": { "group": "description", "empty": "keep" },
            "technology": { "group": "technology", "empty": "keep" },
            "tags": { "group": "tags", "empty": "keep" }
          },
          "insert": { "place": "last-child", "emit": "{id} = container \"{name}\" \"{description}\" \"{technology}\"" },
          "remove": { "cascade": ["relationship"] }
        }
      ],
      "relations": [
        {
          "name": "relationship",
          "type": "Relationship",
          "line": "^(?<source>[A-Za-z_][A-Za-z0-9_]*)\\s*->\\s*(?<destination>[A-Za-z_][A-Za-z0-9_]*)(?:\\s+\"(?<description>[^\"]*)\")?(?:\\s+\"(?<technology>[^\"]*)\")?(?:\\s+\"(?<tags>[^\"]*)\")?\\s*$",
          "within": ["model", "group", "softwareSystem", "container"],
          "source": { "group": "source" },
          "target": { "group": "destination" },
          "attributes": {
            "description": { "group": "description", "empty": "keep" },
            "technology": { "group": "technology", "empty": "keep" },
            "tags": { "group": "tags", "empty": "keep" }
          },
          "insert": { "place": "end", "container": "model", "emit": "{source} -> {target} \"{description}\"[ \"{technology}\"]" },
          "remove": {}
        }
      ],
      "template": {
        "text": "workspace \"{base}\" {\n    model {\n        {key} = softwareSystem \"{base}\" \"Describe {base}.\"\n    }\n    views {\n        container {key} \"containers\" {\n            include *\n            autoLayout lr\n        }\n    }\n}\n",
        "byOrigin": {
          "c4/context": "workspace \"{base}\" {\n    model {\n        {key} = softwareSystem \"{base}\" \"Describe {base}.\"\n    }\n    views {\n        systemContext {key} \"context\" {\n            include *\n            autoLayout lr\n        }\n    }\n}\n",
          "c4/system-landscape": "workspace \"{base}\" {\n    model {\n        {key} = softwareSystem \"{base}\" \"Describe {base}.\"\n    }\n    views {\n        systemLandscape \"landscape\" {\n            include *\n            autoLayout lr\n        }\n    }\n}\n"
        }
      }
    }
  }
}

In an IDE

No IDE host runs this example yet.