TALA, the Diagram Layout Engine Behind D2, Goes Open Source
TALA Is Open-Source
Terrastruct has open-sourced TALA, its autolayout algorithm for D2 diagrams, under the permissive MPL-2.0 license. TALA is designed for software architecture diagrams, producing orthogonal layouts that resemble whiteboard sketches rather than the one-directional flows of DAG-based engines. It balances multiple aesthetic objectives—symmetry, median distance, flow, clustering—and uniquely allows locking node positions and sizes while the engine handles routing, a boon for AI-generated diagrams. The author notes tradeoffs: randomness means layouts can change dramatically with small input changes, and it's slower on large diagrams. TALA is bundled in D2 v0.9.0 and can be tried via `--layout=tala` or the D2 Playground.
This lends itself especially well to agentic use cases, where models can draw in 2d space well, but TALA still takes care of routing, which models still struggle with.
- ricardobeat
The first few graphs are impressive, it does a much tidier job. The Go queue one is objectively worse - the other versions keep services and users grouped together, as well as a left-to-right flow. The TALA version makes it look more complicated than it is.
- aidenn0
That's nice; my first impressions of D2 were much worse than they should have been since the default layout engine is pretty terrible for some types of graphs; ELK is a big improvement, and when I tried TALA it was sometimes a big improvement over ELK.
I never purchased TALA though because I don't use D2 at work, and the costs of buying TALA were above my "fun money" amount.
- ashiban
Thanks for that. What do you think are the key heuristics / concepts that made it standout or be more appropriate for architecture diagrams?