Cloudflare

How we use Abstract Syntax Trees (ASTs) to turn Workflows code into visual diagrams

Mar 27, 2026André Venceslau, Mia Malden
How we use Abstract Syntax Trees (ASTs) to turn Workflows code into visual diagrams
SummaryAI, from the source post

This post details the technical implementation of generating visual diagrams for Cloudflare Workflows code. It describes the challenges of visualizing dynamically executed code, the process of fetching and parsing minified JavaScript using the `oxc-parser` via a Rust Worker compiled to WebAssembly, and the generation of an intermediate graph representation from the AST. It highlights the use of `Promise` and `await` relationships to track parallel and blocking execution, and the mapping of AST nodes to pre-defined workflow node types for rendering.

More from the Edge Computing with Cloudflare Workers trail