Comparison

Lucid Train compared with D2.

D2 is a language you write. Lucid Train reads the code and writes the graph for you.

Download for macOS
v0.1.33 · .dmg · Apple Silicon & Intel
Signed & notarized by Apple · opens without a Gatekeeper warning
sha256 698955a0187bc039f4c74f5d05a9f10fbb27376a45788a0a241d1326b73873c7
Download for Windows instead
$curl -fsSL https://lucidtrain.com/install.sh | sh

D2 is an open-source language that turns declarative text into diagrams, with a CLI that has a watch mode, works offline and exports SVG, PNG and PDF, and a choice of three layout engines. It is one of the better diagram-as-code options precisely because layout quality was a design goal rather than an afterthought. Lucid Train is not a diagram-as-code tool at all: there is no language you write. An agent reads your repository and emits a semantic graph, and a constraint solver draws it.

What a text source genuinely buys you

A D2 file lives in the repository, diffs in a pull request and is versioned with the code it describes. A reviewer can see exactly what changed about the architecture in the same review as the code change. That property is real and valuable, and it is the strongest argument for diagram-as-code over any canvas tool including this one.

The cost is authorship

Somebody writes and maintains the D2 file. That is the same maintenance burden every hand-authored diagram carries, and it is why diagram-as-code files drift too: nothing fails when the code changes and the diagram does not. Generating from the codebase moves that from a discipline to a command.

Layout, from two directions

D2 offers a choice of layout engines and takes layout quality seriously, which is a genuine differentiator among text diagram languages. Lucid Train runs ELK over a graph that has no coordinates in it anywhere, so overlaps are not merely rare but cannot be expressed. Both are choosing a solver over manual placement; they differ in who writes the input.

Offline and open source

D2 is fully open source and its CLI runs with no network, which puts it in the same bracket as Lucid Train's CLI for teams with restrictions. Lucid Train's own CLI is free and open source, and the desktop app runs offline against local models. Neither of these requires you to send anything anywhere.

Side by side

Lucid TrainD2
Diagram sourceGenerated from the repoA .d2 file you write
Diffs in a pull requestSVG output doesYes, the source
LayoutELK solverThree engines to choose from
Runs offlineYesYes
Open sourceThe CLI isFully
ExportsSVG, 2x PNG, Markdown, ExcalidrawSVG, PNG, PDF
Diagram to code as a specificationYesNo
PriceCLI free and open source; desktop $3/month, 7-day trial, no cardFree
FAQ

Questions

Can Lucid Train export D2?

No. Exports are SVG, 2x PNG, Markdown and Excalidraw scenes. There is no D2 output and no D2 import.

Is D2 free?

Yes, fully open source, with a CLI that runs offline and exports SVG, PNG and PDF.

Which produces better-looking diagrams?

Both delegate placement to a solver rather than to a person or a language model, which is the decision that matters most. D2 lets you choose among layout engines; Lucid Train runs ELK with tier bands and bundled service icons.

Affiliation

Lucid Train is an independent product and is not affiliated with, endorsed by, or connected to the product described on this page. All names and trademarks belong to their respective owners. Pricing and features were checked on 22 August 2026 and change without notice; check the vendor's own site before deciding.

Related

Last updated