Top level
(diagram "Title"
<forms...>)
Exactly one diagram per source. Multiple top-level forms allowed; user defmacro may sit outside.
Elements
(person id "Label")- actor (user, role)
(system id "Label" <children>)- system; children become a System_Boundary
(container id "Label" :tech "X")- inside a system
(component id "Label" :tech "X")- inside a container
Attributes (positional, then keyword/value)
:external true- flips to
_Ext in C4
:role :database- shape hint (cylinder for db)
:tech "Phoenix"- tech tag, rendered in label
:style "dashed"- passes through to dot/mermaid
Relationships
(-> a b)- directed edge
(-> a b "uses")- directed edge with label
(-> a b "uses" :tech "HTTPS")- edge with tech
(<-> a b "talks")- bidirectional
Built-in macros
(webapp id "Label")- container with web tech
(rest-api id "Label")- API container
(postgres-db id "Label")- :role :database
(redis-cache id "Label")- :role :database
User macros
(defmacro service [id label tech]
(container id label :tech tech))
(diagram "App"
(service api "API" "Phoenix"))
Top-level only. User macros override built-ins (with a warning).
Levels
Inferred: deepest :kind wins (component > container > context). Filter via (drawl.ir/at-level :context ir) in the JVM API.
Full grammar: GRAMMAR.org