Beautiful, AI-native
diagrams.

A fault-tolerant, Mermaid-compatible diagram library for AI applications. Interactive SVGs from imperfect input.

Input ← try editing
Output

Built for AI-generated syntax

LLMs produce broken Mermaid constantly. Mermaid throws an error and your UI goes blank. Flora renders what it can and tells you what went wrong.

Mermaid
await mermaid.render("id", `
  flowchart LR
    A[Start] --> B{Decision}
    B -->|Yes| C[Do thing
    B -->
    D[End]
`);

// Parse error on line 4
// Nothing renders. App crashes.
Flora
const { warnings } = render(`
  flowchart LR
    A[Start] --> B{Decision}
    B -->|Yes| C[Do thing
    B -->
    D[End]
`, element);

// Renders A, B, D — skips broken lines
// warnings: [{ line: 4, ... }, ...]

Why Flora

Fault-Tolerant Parsing

Flora never throws. It recovers from unterminated brackets, dangling arrows, and malformed lines—rendering what it can and returning structured warnings for the rest.

Beautiful by Default

Subtle gradients, color-coded node shapes, refined typography. Diagrams look polished without any theme configuration. Fully customizable when you need it.

Interactive Out of the Box

Hover highlights, click handlers, and smooth zoom/pan—all built in. No extra config, no plugins. Diagrams are interactive by default.

Mermaid-Compatible & Tiny

Drop-in replacement for Mermaid's flowchart syntax. One dependency (dagre for layout). Ships as ESM and CJS with full TypeScript types.

Lineage Highlighting

Click any node to trace its upstream and downstream dependencies. Everything else fades away — perfect for data pipelines and dependency graphs.

Click a node to trace its lineage

Get Started

npm install @topspinj/flora
import { render } from "@topspinj/flora";

const { warnings } = render(
  `flowchart LR
    A[Start] --> B{Decision}
    B -->|Yes| C[Do thing]
    B -->|No| D[Other thing]`,
  document.getElementById("diagram"),
  { interactive: true }
);

API

render(input, el, opts?)

Parse and render into a DOM element.

toSVGElement(input, opts?)

Returns an SVG element without attaching to DOM.

toAST(input)

Parse and return the abstract syntax tree.

toLayout(input)

Parse and return computed node/edge positions.

Roadmap

Shipped

Flowcharts

Full Mermaid-compatible flowchart syntax with 5 node shapes, 3 edge styles, and chain edges.

Shipped

Fault-Tolerant Parsing

Recovers from broken syntax. Returns structured warnings with line numbers.

Next

Builder API

Build diagrams from JS objects—ideal for AI tool-use with structured output.

Next

Streaming Rendering

Progressive rendering as LLM tokens stream in. Nodes appear in real-time.

Future

More Diagram Types

Entity-relationship diagrams, sequence diagrams, and beyond.