Skip to content

Context map and diagrams

Once a model has grown past one board, it helps to see it from further away. Studio draws two kinds of read-only picture from your model: the context map of an application’s domains, and diagrams of an event model. You never edit them. They are always drawn from the model and follow it as it changes.

A domain is a part of the business with its own language. The context map shows how the domains of one application relate: which domain publishes events and which takes them. In Acme Commerce, for example, the Catalog publishes price changes and Sales takes them in.

In the project drawer, expand an application and select Context map.

If the application has no domains yet, the map says so. If an event model could not be read, the map says that too, rather than quietly leaving out what it should say, and offers Try again.

The map uses the notation of context mapping.

  • Every domain is a box marked «bounded context», listing the Published language it offers: the public events other domains can take.
  • Systems outside the application are drawn with a dashed outline. Other applications that a contract is published to are shown under Other applications.
  • Every relationship is a line between two domains. Its upstream end is marked U and its downstream end D, with the patterns each side takes: open host service (OHS) and published language (PL) upstream, anticorruption layer (ACL) and conformist (CF) downstream. The line is labeled with the events that cross it. Its tooltip reads in full, for example Sales takes these events from Catalog.

Select a domain to open its board. Select a relationship to open the slice that takes its events.

Studio can draw an event model in four more ways. Open Project options, choose Diagrams and pick one:

The Project options menu open on an event model, with Diagrams expanded to UML state diagram, UML activity diagram, UML sequence diagram and Entity data model
Project options > Diagrams lists the four diagrams you can draw from an event model.
Diagram What it shows
UML state diagram The states that the event model’s events lead to.
UML activity diagram The flow of the slices: decisions, forks and merges, where a command is rejected, and what the system does.
UML sequence diagram One feature as messages between the user, screens, the command API, the event store, read models and external systems.
Entity data model The read models as entities and how they relate.
  1. Select Project options at the top left and choose Diagrams.
  2. Pick the diagram you want. It opens full screen.
  3. At the top of the diagram, choose which event model to draw if the project has more than one. In the picture below it reads Catalog / Catalog.
  4. For the state, activity and entity diagrams, narrow it with All modules, the second selector. For the sequence diagram, choose a Feature instead.
The UML State Diagram full screen for the Catalog event model with All modules chosen: the states ProductDrafted, ProductPriceSet and ProductDescribed joined by labeled transitions, zoomed to 88 percent
Each box is a state, such as ProductDrafted, and each arrow is a transition labeled with the command that causes it, such as SetProductPrice. Use Zoom Out, Reset Zoom and Zoom In at the lower right to move around.

A diagram can say it has nothing to draw: for example, a feature in which nothing sends a message produces no sequence diagram. That is the model telling you it has not been drawn that far yet. The diagrams are read-only, so to change what they show, change the model on the event model board.