Experimental Livebook-friendly DSL for sketching software dependency graphs.
This Lab DSL compiles to the stable, pipe-first Choreo.Dependency builders and
returns an ordinary %Choreo.Dependency{}. It is useful for quick architecture
sketches, refactoring conversations, onboarding maps, and interview explanations
of coupling between applications, modules, libraries, interfaces, and tests.
Examples
iex> import Choreo.Lab.DSL.Dependency
...> deps = dependency do
...> core = cluster("Core")
...> api = application("API Gateway")
...> auth = module("Auth", cluster: core)
...> contract = interface("Auth Behaviour")
...> phoenix = library("Phoenix")
...>
...> api ~> phoenix |> uses("HTTP stack")
...> api ~> auth |> calls("validates token")
...> auth ~> contract |> implements("implements callbacks")
...> end
iex> Enum.sort(Choreo.Dependency.nodes(deps))
[:api, :auth, :contract, :phoenix]Edges can use generic, typed, or pipe-modified forms:
api ~> auth
api ~> auth |> calls("validates token")
edge api ~> phoenix, uses: "framework"
imports module_a ~> module_b, "alias/import"
dev app ~> test_lib, "test helper"
Summary
Functions
Builds a %Choreo.Dependency{} from a compact Lab DSL block.
Returns the vocabulary supported by the dependency DSL.
Compatibility alias for taxonomy/0.
Types
@type edge_decl() :: %{from: Yog.node_id(), to: Yog.node_id(), opts: keyword()}
@type node_decl() :: %{id: Yog.node_id(), builder: atom(), opts: keyword()}
Functions
Builds a %Choreo.Dependency{} from a compact Lab DSL block.
@spec taxonomy() :: %{ clusters: [atom()], nodes: [atom()], edges: [atom()], modifiers: [atom()], options: [atom()] }
Returns the vocabulary supported by the dependency DSL.
iex> taxonomy = Choreo.Lab.DSL.Dependency.taxonomy()
iex> :application in taxonomy.nodes
true
iex> :cluster in taxonomy.clusters
true
iex> :calls in taxonomy.edges
true
@spec verbs() :: map()
Compatibility alias for taxonomy/0.