Skip to content

Latest commit

 

History

History
 
 

workspace-extension

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Workspace extension

The Structurizr DSL provides a way to extend an existing workspace, enabling you to reuse common elements/relationships across multiple workspaces. To use this feature, define your workspace as normal. For example:

workspace {

    !identifiers hierarchical

    model {
        a = softwareSystem "A"
        b = softwareSystem "B"
        
        a -> b "Gets data X from"
    }
        
}

Next, define your child workspace, using the extends keyword to specify the workspace that should be extended. For example:

workspace extends https://raw.githubusercontent.com/structurizr/dsl/master/docs/cookbook/workspace-extension/system-landscape.dsl {

    model {
        !ref a {
            webapp = container "Web Application"
            database = container "Database"
            
            webapp -> b "Gets data X from"
            webapp -> database "Reads from and writes to"
        }
    }
    
    views {
        systemContext a "A-SystemContext" {
            include *
            autolayout lr
        }

        container a "A-Containers" {
            include *
            autolayout
        }
    }
    
}

In this example we're extending a workspace that's accessible via a public URL, but you can also specify the name of a local file. We can use the !ref keyword to reference and extend the existing software system named "A", which is identified in the parent workspace as a. Since b is already defined in the parent workspace, we can reference it from the child workspace as if it was defined locally.

This will create a system context diagram:

And a container diagram:

Links