-
Notifications
You must be signed in to change notification settings - Fork 2
Home
dictim is a bridge between Clojure/script and the d2 and dot declarative diagram languages.
It has several parts:
- A syntax for describing d2 using Clojure vectors and maps. This syntax is called 'dictim'.
- A compiler for converting dictim syntax Clojure data structures into d2 strings.
- A parser for reading d2 strings and converting into dictim syntax Clojure data structures.
- a formatter for formatting d2 strings. This is usually invoked on the output of the compilation step.
- utilities for flattening and re-building dictim. The flat format is easier to manipulate,
dictim is a 'building block' type library, designed to be built upon by other libraries.

Producing diagrams dynamically is super powerful when those diagrams are trying to represent aspects of a complex, fast moving system.
For example, say you're working in Technology in a large organization which has hundreds of applications and thousands of flows of data betwen them, then it's very hard to keep up with a set of fixed, statically maintained architecture diagrams that probably don't show the exact view you were looking for.
A better approach would be to collect and maintain the metadata about the applications and flows and then dynamically produce diagrams of selections of that metadata on the fly.
d2 is a toolkit for producing (technology) architectural diagrams from a text description (the d2 language). The text description is a great building block, but is isn't data in a programming language environment, so still has to be produced either by hand or by something else.
Dictim is the something else if you're working in Clojure/script. You can write a program to gather the metadata you're trying to diagram, convert it into dictim and then use this library to produce the d2 on the fly. If the diagram is then updated in the Terrastruct gui, then you can go back from the updated d2 description to dictim and update your metadata stores.
Dictim is designed for others to build on top of rather than as an end in itself, very much like hiccup is to html in the Clojure/script world.
graphdict is an example of building on top of dictim. It's a library for converting a graph representation of your data into dictim.
dictim.cookbook has some example recipes for using dictim.