Back Original

TALA Is Open-Source

Following up on the announcement here, TALA (Terrastruct's AutoLayout Algorithm) is now open-source under the same license as D2 (MPL-2.0).

TALA is a novel autolayout algorithm designed with software architecture diagrams in mind. This means it's primarily an orthogonal layout engine, which more closely matches what you might find on whiteboards, rather than the DAG-based ones that grow in one direction. It blends ideas from different graph-drawing research papers (cited in source code) along with original techniques to achieve aesthetic diagrams. It considers multiple objectives of "aesthetic", including symmetry, median distance, flow, clustering of like nodes, and much more.

I'll keep the text short and lead with examples.

Please also note that TALA is not without tradeoffs.

TALA comes bundled into D2 v0.9.0, so just install and specify with --layout=tala to try it out! Or head on over to https://play.d2lang.com, which runs 100% client-side. I especially look forward to the improvements that being open-source brings, and can't wait to see what improvements and ideas are submitted by the community.

Special thanks to Gavin Nishizawa for substantial broad contributions across TALA, and Júlio César Batista for his work on hierarchy algorithms and more. It was so fun getting to work on such interesting stuff with you guys.

Batch 1: Comparisons

Fulcro RAD architecture

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Mocha secure-enclave SoC

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Jupyter on AWS EKS

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Lion Reader frontend data flow

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

ROSS rotor-dynamics workflow

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Go Queue worker architecture

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Ouroboros Leios simulator

Select a diagram to enlarge it. Each layout is scaled to fit its panel.

Batch 2: Custom positioning

Signal House

Signal House
View D2 source

Atlas / Data platform

Atlas / Data platform
View D2 source

Night shift / Mission control

Night shift / Mission control
View D2 source

Friday deploy: the escape room

Friday deploy: the escape room
View D2 source

The Internet is a jellyfish

The Internet is a jellyfish
View D2 source

Orbital coffee logistics

Orbital coffee logistics
View D2 source

Cloud Conservatory

Cloud Conservatory
View D2 source

Velvet Rope

Velvet Rope
View D2 source

Synthwave City

Synthwave City
View D2 source

Batch 3: Partial positioning

The Printing Room

The Printing Room

Pinned: The four CMYK stations share a fixed top coordinate and equally spaced left coordinates so the print sequence retains its mechanical alignment.

Automatic: TALA positions the feeder, camera, registration controller, dryer, prepress and finishing steps; none has top or left.

See the positioning declarations
View D2 source

MULE / Utility Rover

MULE / Utility Rover

Pinned: The four motor assemblies are fixed at the front and rear corners of the chassis rectangle.

Automatic: TALA places every controller, sensor, power and safety node between or around those corners and arranges the unpositioned fleet container.

See the positioning declarations
View D2 source
Sources and rendering details

The seven layout comparisons use public project diagrams from D2's real-world fixtures. Each comparison uses the same D2 source and the same compiler build, changing only the layout engine. Source styles, themes, and explicit grid constraints are preserved. Some fixture icons were already replaced with built-in shapes.

SVGs are scaled independently to fit each panel. Use Open SVG to inspect labels and connections at a larger size.

Source provenance and licenses ·

Render settings and revisions

The eleven positioning examples are original, fictional compositions rendered with TALA using the same public D2 build. Icon downloads include the full source and local vector assets. The two partial-positioning examples apply top/left only to their listed pinned nodes; all other nodes and every container are automatically placed.

Positioning render settings

.