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

@hydro-project/hydroscope

v1.3.0

Published

React-based graph visualization library for Hydro dataflow programs

Readme

@hydro-project/hydroscope

CI

A web-based interactive graph visualization and exploration library, well suited for exploring large directed graphs, especially those that have nested subgraph structure.

Hydroscope was originally designed for visualizing Hydro dataflow graphs, which come with two distinct nested hierarchies: call stacks and runtime locations. However Hydroscope is not tightly coupled to Hydro and is configurable for use with any directed graph -- nested or flat.

Features

  • Hierarchical Graph Visualization: Visualize complex nested container structures with automatic layout
  • Interactive Controls: Pan, zoom, search, and navigate through graph hierarchies
  • Smart Node Collapsing: Collapse and expand containers with preserved relationships
  • Search and Focus: Functionality to search for nodes in the graph and hide subgraphs to improve focus.
  • Info Panels: View detailed node information with context-aware popups

Installation

npm install @hydro-project/hydroscope

Usage Guides

Quick Start

Loading from JSON File

The most common way to use Hydroscope is to load a graph from a JSON file:

import { Hydroscope } from "@hydro-project/hydroscope";
import "@hydro-project/hydroscope/style.css";
import { useState, useEffect } from "react";

function App() {
  const [graphData, setGraphData] = useState(null);

  useEffect(() => {
    // Load your graph JSON file
    fetch("/data/my-graph.json")
      .then((res) => res.json())
      .then((data) => setGraphData(data))
      .catch((err) => console.error("Failed to load graph:", err));
  }, []);

  if (!graphData) return <div>Loading...</div>;

  return (
    <div style={{ width: "100vw", height: "100vh" }}>
      <Hydroscope
        initialGraph={graphData}
        onReady={(api) => console.log("Graph ready!", api)}
      />
    </div>
  );
}

Minimal JSON Example

The simplest graph requires just nodes and edges:

{
  "nodes": [
    { "id": "1", "nodeType": "Source", "shortLabel": "input" },
    { "id": "2", "nodeType": "Transform", "shortLabel": "process" },
    { "id": "3", "nodeType": "Sink", "shortLabel": "output" }
  ],
  "edges": [
    { "id": "e1", "source": "1", "target": "2" },
    { "id": "e2", "source": "2", "target": "3" }
  ]
}

Loading from URL or File Upload

function GraphViewer() {
  const [graphData, setGraphData] = useState(null);

  const handleFileUpload = (event) => {
    const file = event.target.files[0];
    if (file) {
      const reader = new FileReader();
      reader.onload = (e) => {
        const data = JSON.parse(e.target.result);
        setGraphData(data);
      };
      reader.readAsText(file);
    }
  };

  return (
    <div>
      <input type="file" accept=".json" onChange={handleFileUpload} />
      {graphData && (
        <div style={{ width: "100vw", height: "90vh" }}>
          <Hydroscope initialGraph={graphData} />
        </div>
      )}
    </div>
  );
}

For complete JSON format documentation, see JSON Format Specification.

API Reference

<Hydroscope /> Component

Props

  • initialGraph: Graph data with nodes and edges
  • onReady: Callback invoked when the graph is rendered and interactive
  • enableSearch: Enable/disable search functionality (default: true)
  • enableHierarchyTree: Show hierarchy tree view (default: true)
  • layoutOptions: Custom ELK layout configuration

API Methods

When onReady is called, you receive an API object with methods:

  • getNodes(): Get all nodes in the graph
  • getEdges(): Get all edges in the graph
  • centerNode(nodeId): Center view on a specific node
  • collapseContainer(nodeId): Collapse a container node
  • expandContainer(nodeId): Expand a container node
  • search(query): Search for nodes by label

Styling

Import the default styles in your application:

import "@hydro-project/hydroscope/style.css";

You can customize the appearance by overriding CSS variables or providing your own styles.

Development

This project uses:

  • TypeScript for type safety
  • React Flow for graph rendering
  • ELK (Eclipse Layout Kernel) for graph layout
  • Vitest for testing
  • Rollup for building

Setup

npm install
npm run build
npm test

Running Tests

# Run all tests
npm test

# Run performance tests
npm run test:performance

Documentation

For detailed documentation, see:

Sample Data

Example JSON files are available in test-data/:

  • paxos.json - Complex distributed system (543 nodes, 581 edges)
  • chat.json - Simpler chat application example

These can be used as templates for your own graph data.

Contributing

Contributions are welcome! Please ensure all tests pass and follow the existing code style.

License

Apache-2.0 - See LICENSE for details.

Credits

Built by the Hydro Project team.