Generate from source

Generate an architecture diagram from a Rust project.

Cargo already knows the crate graph, so a workspace diagram is mostly a rendering of something the build system computes anyway.

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

What it reads

Cargo.toml for the crate and its dependencies, the workspace members list where there is one, and then the module tree from lib.rs or main.rs. Rust's module system is explicit, so the structure declared in the code is the structure, with none of the ambiguity that dynamic languages introduce.

How Rust becomes components

In a workspace, each crate is a component and the dependency edges come straight from Cargo. Within a crate, modules become components where they own something meaningful, and trait definitions are treated as boundaries in the same way Go interfaces are. Feature flags are read, because a crate whose shape changes substantially with features has more than one architecture and it is worth knowing which one is drawn.

Why the layout can be trusted

The agent reads the files listed above and emits a semantic graph: components, the tier each belongs to, and the edges between them, with no coordinates anywhere. The ELK layout engine then computes positions and orthogonal edge routing. This is why the output cannot come back with boxes overlapping or arrows crossing through cards, which is the usual failure when a language model is asked to place things on a canvas itself.

Async runtimes and task boundaries

Where a project spawns long-lived tasks, those are components in every practical sense: they have a lifetime, they own state and they communicate over channels. Drawing them alongside the module structure gives a more accurate picture of what runs than the module tree alone, which describes how the code is organised rather than how it executes.

Your code stays on your machine

It runs on your machine. With a local Ollama model nothing leaves the laptop at all, and with your own API key the file contents go to the provider you chose and never through us. For a source that is your actual codebase, that distinction is usually the deciding one.

Rust to diagram

In the projectIn the diagram
Cargo.tomlCrate identity and dependencies
Workspace membersComponents, with edges from the crate graph
Module tree from lib.rs or main.rsInternal structure
Trait definitionsBoundaries between components
Feature flagsNoted where they change the shape
Spawned async tasksLong-lived components
Channels between tasksEdges
#[cfg(test)] modulesNot drawn

The prompt

shell
$ Survey this Rust workspace and diagram it: the crates, their dependencies, the trait boundaries inside the main crate, and the async tasks.
FAQ

Questions

Does it run cargo?

No, it reads files. Nothing is compiled and no toolchain is required.

Does it handle workspaces?

Yes, and workspaces are where it is most useful, since the crate graph is a real architecture diagram rather than an inferred one.

What about macro-generated code?

Partially. Well-known derives are understood by convention; a custom procedural macro that generates substantial structure will be under-represented.

Can it diagram an embedded or no_std project?

Yes. The module and crate structure reads the same way; there are simply fewer external service edges to draw.

Related