logo

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

ID: 847602db-2220-5d8a-8c4c-760b5adb9141

STIX ID: report--847602db-2220-5d8a-8c4c-760b5adb9141

Feed Name: Cloudflare Blog

Date Published: 2026-03-27

Date Updated: 2026-04-27

Author: André Venceslau

...
...

This blog post explains how Cloudflare generates visual diagrams for Cloudflare Workflows by fetching bundled scripts at deploy time, parsing minified JavaScript/TypeScript into abstract syntax trees (ASTs) using oxc-parser and a Rust Worker, and translating AST nodes into a graph of predefined workflow node types. It describes challenges such as handling minification differences, tracking async/parallel execution with starts/resolves indices, identifying functions that call steps (directly or indirectly), and the resulting node taxonomy (e.g., StepDo, ParallelNode, IfNode) used to render diagram visualizations for debugging and tracing workflow execution.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.