Installation
npm i sfn-diagrampnpm add sfn-diagramyarn add sfn-diagrambun add sfn-diagramThe core package pulls in no browser engine or native rasterizer — SVG and Mermaid generation stay lightweight. PNG export uses @resvg/resvg-js, a native, browser-free rasterizer, provided by an optional peer dependency. Install it only if you use sfn-diagram/png:
npm i sfn-diagram @resvg/resvg-jspnpm add sfn-diagram @resvg/resvg-jsyarn add sfn-diagram @resvg/resvg-jsbun add sfn-diagram @resvg/resvg-jsDeno / JSR
Section titled “Deno / JSR”deno add jsr:@yusufaf/sfn-diagramCLI without Node
Section titled “CLI without Node”Every release ships standalone executables for Linux, macOS, and Windows, so the command line works without installing Node.js:
brew install yusufaf/tap/sfn-diagramOr download a binary from the releases page
and put it on your PATH. The binaries render SVG, Mermaid, and HTML; PNG export needs the
native rasterizer, so use the Docker image or the npm package with
@resvg/resvg-js for that. See
Use from Python, Go, Java, and other languages for details
and subprocess examples.