Node API

import { readFile, writeFile } from 'node:fs/promises';
import { renderToSVG } from 'workflow-render/core';

const json = JSON.parse(await readFile('workflow.json', 'utf8'));
const { svg, warnings } = await renderToSVG(json);

await writeFile('workflow.svg', svg);

The package is ESM only and ships its own types.

renderToSVG(json, options?)

Returns { svg, warnings }. It rejects when the input is not a workflow or an execution.

OptionMeaningDefault
embedFontsEmbed the fonts in the SVG so it renders the same everywheretrue
remoteImagesAllow sticky-note images from other hostsfalse
iconsUse your own icon catalogue instead of the bundled onebundled
subtitlesUse your own subtitle catalogue instead of the bundled onebundled

Lower-level exports

The same subpath exports the individual steps, for callers that want to work with the model between them.

ExportWhat it does
parseInputTurn workflow or execution JSON into the canvas model
layoutPosition the model
renderSVGDraw a positioned model
exportSVGProduce a standalone SVG, fonts included
loadIcons, loadDescriptions, loadSubtitlesLoad the bundled n8n data

Using a different n8n extraction

Set WORKFLOW_RENDER_DATA to a directory shaped like the package's own data/ folder.

WORKFLOW_RENDER_DATA=./my-data npx workflow-render export workflow.json -o workflow.svg