Generate up-to-date architecture diagrams from JavaScript source files without drawing them by hand.
Document a module by exporting its import and export structure as an SVG for a README or wiki.
Visualize the logic flow inside a complex function to explain it clearly to a teammate.
js2flowchart is a JavaScript library that takes any JavaScript code and turns it into a visual flowchart exported as an SVG image. You paste in code, and the tool produces a diagram showing how the logic flows: which branches are taken, what loops exist, and how functions relate. It works both in a browser and on a server, and supports modern JavaScript including ES6 syntax. One of the more practical features is the ability to control how much detail the chart shows. You can ask it to render only the top-level imports and exports of a file, just the class and function names, or a full step-by-step logic trace. This lets you zoom out to get a bird's-eye view of a module or zoom in on a specific function's behavior. You can also highlight specific nodes to draw attention to an important section, or blur nodes to de-emphasize less critical parts. The library includes a command-line tool so you can point it at a local JavaScript file and get an SVG file back without writing any code. For projects where you want to document code or explain it to others, this gives you a way to generate up-to-date diagrams directly from the source rather than drawing them by hand. A live demo editor is linked from the repository where you can paste code and download the resulting SVG. Customization is supported through themes and style overrides. The project also lets you define your own abstraction levels or modify how specific code patterns are mapped to flowchart shapes, for example treating array methods like map and filter as loop structures in the diagram. The original motivation, as described in the README, was reducing the manual effort of drawing and redrawing architecture diagrams every time code changes.
← bogdan-lyashenko on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.