explaingit

adrai/flowchart.js

8,692JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

JavaScript library that turns a short plain-text script into a clean SVG flowchart diagram in the browser, no drag-and-drop diagramming tool needed.

Mindmap

mindmap
  root((flowchart.js))
    What it does
      Text to SVG diagram
      Browser rendering
      CLI generation
    Node Types
      Start and end
      Condition branch
      Parallel paths
      Subroutine
    Syntax
      Define nodes first
      Then connections
      Reuse nodes freely
    Use Cases
      Docs diagrams
      Logic flowcharts
      Process mapping
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Render flowcharts from a text description directly in a web page

USE CASE 2

Add auto-generated diagrams to a documentation site without design tools

USE CASE 3

Create conditional branch diagrams using yes/no decision nodes

USE CASE 4

Generate flowchart images from the command line via the diagrams CLI tool

Tech stack

JavaScriptRaphaelSVG

Getting it running

Difficulty · easy Time to first run · 5min

Requires the Raphael library for SVG rendering, no npm install docs, designed for browser use via CDN.

License not specified in the explanation, check the repository directly before using in a commercial project.

In plain English

Flowchart.js is a JavaScript library that turns simple text descriptions into flowchart diagrams. Instead of dragging and dropping shapes in a diagramming tool, you write a short plain-text script that describes your nodes and the connections between them, and the library renders it as a clean SVG image in the browser. The text format has two parts. First you define each step (called a node) by giving it a name, a type, and a label. Types include start, end, operation, condition, input, output, subroutine, and parallel. Then in a separate section you write out the connections using arrows, like nodeA->nodeB->nodeC. Condition nodes branch two ways based on yes or no answers. Parallel nodes can split into multiple simultaneous paths. You can also attach external links to nodes and optionally highlight specific paths with custom colors and line widths. The library runs in the browser and requires a separate library called Raphael for rendering SVG. It is available through CDNJS so you can include it in a web page without downloading anything. There is also a command-line tool (via a separate project called diagrams) if you want to generate flowchart images from a terminal rather than a browser. Nodes and connections are defined separately in the syntax, which means you can reuse the same node in multiple connections without redefining it. Visual styling can be changed per node or per connection directly in the text, without needing a separate config file. The project is open source. The README is thorough on syntax but does not describe installation for a Node.js project, pointing instead to the demo HTML file and the CDN for browser use.

Copy-paste prompts

Prompt 1
Write a flowchart.js script that shows a user login flow with a yes/no branch for authentication success.
Prompt 2
How do I include flowchart.js in a plain HTML page using the CDNJS CDN link?
Prompt 3
Create a flowchart.js diagram with parallel paths that split and then merge back together.
Prompt 4
How do I add a clickable external link to a node in a flowchart.js diagram?
Prompt 5
Style specific nodes and arrows with custom colors and line widths in flowchart.js.
Open on GitHub → Explain another repo

← adrai on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.