Paste code, get a real control-flow chart — decision diamonds, loops with
loop-back edges, functions as collapsible containers, and return/break/
continue drawn as jump edges to where they actually go.
Supports Python, JavaScript, Java, Ruby, C++ (heuristic parser).
npm install
npm run devThen open the URL Vite prints (usually http://localhost:5173).
npm run build # outputs to dist/
npm run preview # preview the built sitesrc/
CodeFlowVisualizer.jsx # UI: canvas, pan/zoom, sidebar, export
flowEngine.js # parsing: mask → depth → block tree → clean labels
layoutEngine.js # tidy-tree layout + jump-edge routing
samples.js # quick-load code samples
App.css / index.css # styles
main.jsx # entry point
- Mask strings/comments so braces inside them don't break nesting.
- Depth: indentation (Python),
end-stack (Ruby), or statement-splitting on{ } ;outside parens (JS/Java/C++) — soif (x) { break; }on one line still nests correctly. - Tree: build real parent/child blocks (if/elif/else, loops, functions).
- Labels: extract the meaningful part —
if (n > 0) {becomesn > 0?,def check(x):becomescheck(x). - Layout: recursive tidy-tree — branches sit side by side and merge back; loops draw a loop-back edge; jumps route to loop exit / loop head / function end.
It's a heuristic parser, not a full compiler — deeply unusual code can have edge
cases. For bulletproof JS specifically, swap the JS front-end for acorn.
- scroll = zoom, drag = pan, Fit button = frame the whole chart
- click a function's ▸ to collapse its body
- Export PNG saves the diagram