npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

struktolab

v0.4.2

Published

A web-based structogram (Nassi-Shneiderman diagram) editor and renderer with code generation

Downloads

733

Readme

StruktoLab

A free, web-based structogram (Nassi-Shneiderman diagram) editor with automatic code generation. Built entirely with web components — no framework dependencies.

Features

  • 📝 Bidirectional pseudocode editing (visual ↔ text)
  • 🌍 German and English pseudocode support
  • 💻 Code generation for Python, Java, and JavaScript
  • 💾 Save/Load as JSON
  • 🖼 Export as PNG or SVG image
  • 🔗 Shareable URLs (state compressed in URL hash, compatible with struktolab.openpatch.org)
  • 📦 Web components — embed anywhere with zero dependencies

Web Components

<struktolab-editor>

Full-featured visual editor with toolbar, pseudocode sync, and import/export.

<script src="https://cdn.jsdelivr.net/npm/struktolab/dist/editor/struktolab-editor.umd.min.js"></script>

<!-- Empty editor -->
<struktolab-editor font-size="14"></struktolab-editor>

<!-- With German pseudocode -->
<struktolab-editor font-size="14">
  <script type="text/pseudocode">
    eingabe("Zahl n")
    ergebnis = 1
    wiederhole für i = 1 bis n:
        ergebnis = ergebnis * i
    ausgabe(ergebnis)
  </script>
</struktolab-editor>

<!-- With English pseudocode -->
<struktolab-editor font-size="14" lang="en">
  <script type="text/pseudocode">
    input("number n")
    result = 1
    repeat for i = 1 to n:
        result = result * i
    output(result)
  </script>
</struktolab-editor>

<!-- From JSON -->
<struktolab-editor font-size="14">
  <script type="application/json">
    { "type": "TaskNode", "text": "x = 42" }
  </script>
</struktolab-editor>

Attributes

| Attribute | Description | Default | |-------------|------------------------------------|---------| | width | Fixed width in pixels | auto | | font-size | Font size in pixels | 14 | | lang | Pseudocode language (de or en) | de | | src | URL to a JSON tree file | — | | color-mode | Color mode (color, bw) | color |

JavaScript API

const editor = document.querySelector('struktolab-editor');

// Get/set tree
editor.tree = { type: "TaskNode", text: "hello" };
console.log(editor.tree);

// Pseudocode
editor.pseudocode = 'eingabe("Zahl n")';

// Code generation
editor.toCode('python');    // → Python code
editor.toCode('java');      // → Java code
editor.toCode('javascript'); // → JavaScript code

// Save/Load JSON (clean, no internal IDs)
const json = editor.saveJSON();
editor.loadJSON(json);

// Export image
const pngBlob = await editor.exportImage('png');
const svgBlob = await editor.exportImage('svg');

// Programmatic update
editor.change({ type: "TaskNode", text: "updated" });

// Listen for changes
editor.addEventListener('change', (e) => {
  console.log('Tree changed:', e.detail.tree);
});

<struktolab-renderer>

Read-only SVG renderer for displaying structograms.

<script src="https://cdn.jsdelivr.net/npm/struktolab/dist/renderer/struktolab-renderer.umd.min.js"></script>

<struktolab-renderer font-size="14">
  <script type="text/pseudocode">
    falls x > 0:
        ausgabe("positiv")
    sonst:
        ausgabe("nicht positiv")
  </script>
</struktolab-renderer>

Same attributes and tree format as the editor.

Shareable URLs

StruktoLab supports shareable URLs with the structogram state compressed in the URL hash using pako (zlib). This is compatible with existing URLs from struktolab.openpatch.org.

Example:

https://example.com/#pako:eNqlkstuE0EQRf-l166kH9Ov2UaJ...

The state is updated automatically as you edit.

Development

Prerequisites

  • Node.js (v14+)
  • npm

Setup

git clone https://github.com/openpatch/struktolab.git
cd struktog
npm install

Dev Server

npm run dev

Production Build

# App (index.html + bundled editor)
npm run build

# Component libraries (UMD + ES modules)
npm run build:renderer
npm run build:editor

# All at once
npm run build:all

Outputs:

  • build/ — app with index.html
  • dist/renderer/struktolab-renderer.umd.js / .es.js
  • dist/editor/struktolab-editor.umd.js / .es.js

Supported Node Types

| Node | Description | |------|-------------| | Task | Simple statement | | Input | Read input | | Output | Write output | | If/Else | Two-way branch | | Switch/Case | Multi-way branch | | While | Head-controlled loop | | Do-While | Foot-controlled loop | | For | Counter-controlled loop | | Function | Function definition | | Try/Catch | Exception handling |

License

MIT — see license.md

Credits

Based on the original structogram editor by Didaktik der Informatik, TU Dresden.