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

diagram-engine

v0.1.10

Published

A React + TypeScript library and web application that renders structured diagram payloads as interactive visualizations on [React Flow](https://reactflow.dev). Define your diagrams as JSON and get polished, themeable, editable diagrams instantly.

Readme

Diagram Engine

A React + TypeScript library and web application that renders structured diagram payloads as interactive visualizations on React Flow. Define your diagrams as JSON and get polished, themeable, editable diagrams instantly.

The application UI is branded as AI Systems Designer. The package is published as diagram-engine.

What it renders

Sequence Diagrams

Model message flows across actors with automatic lane-based layout. Actors get color-coded columns and the engine computes positions from index, row, and from/to lane relationships — no manual coordinates needed.

Sequence diagram showing Claude Code delegating to sub-agents

State Diagrams

State machines with color-coded states, decision nodes, and labeled transitions. Supports auto-layout with crossing minimization to keep edges clean, plus manual positioning when you need fine control.

State diagram showing an autonomous agent workflow with plan, tools, and human guidance states

The engine also supports overview (architecture diagrams with icons), entity (data model diagrams), and block (flowchart) diagram types.

Capabilities

Diagram types — sequence, state, overview, entity, and block diagrams, each with purpose-built node and edge renderers.

Auto-layout — Sequence diagrams compute lane positions automatically from actor relationships. State and block diagrams support grid-based auto-layout with crossing minimization algorithms to reduce visual clutter.

Theme system — Light and dark mode with CSS custom properties. Customize canvas, node, connector, and sequence actor colors at the project or per-diagram level via JSON theme tokens.

Rich text labels — Labels and descriptions use a Markdoc-like portable JSON format supporting paragraphs, inline code, and custom tags.

Runtime validationassertDiagramDefinition() validates any JSON payload and throws descriptive errors for malformed input, so you catch issues before rendering.

Interactive editing — Drag nodes, reconnect edges, add or delete elements directly on the canvas. All changes sync back to the JSON source.

Export — One-click export to PNG, JPEG, or SVG from the toolbar. Programmatic export available via the Playwright-based headless script.

Custom edge routing — Orthogonal, dashed, and raised edge styles with automatic path computation for clean, readable connections.

Library package — Consume diagram-engine as an npm dependency. Import buildDiagramFlow, custom nodeTypes/edgeTypes, and the theme resolver to embed diagrams in your own React app.

Quick start

npm install
npm run dev

Open the local Vite URL in your browser. Select a diagram from the sidebar to see it rendered, or edit the JSON source directly.

npm run build     # production build
npm test          # run tests

Creating diagrams

Generate new diagrams from natural language using the /create-diagram Claude Code skill:

/create-diagram a three-actor checkout flow with client, server, and payment API
/create-diagram a state machine for an order lifecycle as PNG

Generated JSON is written to src/data/library/ and appears in the sidebar automatically.

You can also author diagrams manually as JSON following the DiagramDefinition schema. Build diagrams programmatically using the exported buildDiagramFlow() function — see the library API reference for details.

Project structure

src/
  engine/          Library package — schema, layout, nodes, edges, markdoc, themes
  app/             Application UI — sidebar, toolbar, panels
  data/            Built-in fixtures and JSON library files
  data/library/    Example diagrams auto-discovered at runtime
    sequence/      5 sequence diagrams
    state/         11 state diagrams
    overview/      2 overview diagrams
    block/         2 block diagrams
scripts/           Build, release, and export scripts
assets/            README screenshots
diagram-screenshots/  Batch-generated screenshots (light + dark)

Library API

For embeddable use in your own React app, install the package and see the library consumer documentation for the full API reference, quick-start example, and token customization guide.