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

force-3d-graph

v1.2.2

Published

A 3D force-directed graph visualization library built with Three.js

Readme

Force 3D Graph

A high-performance 3D force-directed graph visualization library built with Three.js. This library allows you to visualize complex network structures with interactive nodes, edges, and smooth animations.

Features

  • High Performance: Optimized using spatial indexing (Octree) and Level of Detail (LOD) for handling large graphs.
  • Interactive: Support for node clicking, hovering, and tooltips.
  • Dynamic: Real-time addition and removal of nodes and edges.
  • Customizable: Extensive options for appearance and physics behavior.
  • Expandable: Built-in support for expanding nodes (fetching more data on interaction).

Installation

You can install the library via npm:

npm install force-3d-graph

Local Development

If you want to use the library locally without publishing to npm, see LOCAL_DEVELOPMENT.md.

1. Build the Library

In the force-graph directory, run:

npm install
npm run build

2. Link the Library

To use it in another project on the same machine:

# In the force-graph directory
npm link

# In your project directory
npm link force-3d-graph

Alternatively, you can install it via file path:

npm install /path/to/force-graph

Quick Start

import { ForceGraph3D } from 'force-3d-graph';

// Data format
const data = {
  nodes: [
    { id: '1', label: 'Node 1', color: 0xff0000 },
    { id: '2', label: 'Node 2', color: 0x00ff00 }
  ],
  edges: [
    { source: '1', target: '2', relationship: 'connected' }
  ]
};

// Initialize the graph
const graph = new ForceGraph3D(document.getElementById('graph-container'), {
  backgroundColor: '#0a0a0a',
  onNodeClick: (node) => {
    console.log('Clicked node:', node);
    graph.focusOnNode(node.id);
  }
});

// Set data
graph.setData(data);

API Reference

ForceGraph3D(container, options)

Constructor to create a new graph instance.

Methods

| Method | Description | | :--- | :--- | | setData(data: GraphData) | Load a complete graph data set. | | addNode(node: NodeData) | Add a single node. Returns boolean (success). | | removeNode(nodeId: string) | Remove a node and its connected edges. | | addEdge(edge: Edge) | Add an edge between two existing nodes. | | removeEdge(source, target) | Remove an edge. | | focusOnNode(nodeId, distance) | Smoothly animate camera to focus on a node. | | expandNode(nodeId, depth) | Trigger node expansion (requires onExpand callback). | | searchNodes(query) | Search nodes by label or ID. | | getAllNodes() | Get array of all current nodes. |

Events

Register listeners using graph.on(eventName, callback):

  • nodeClick: (node: NodeData)
  • nodeHover: (node: NodeData | null)
  • edgeHover: (edge: Edge | null)
  • ready: ()

Data Format & Conversion

The library expects data in a specific GraphData format. For detailed instructions on how to convert your existing data structures, see DATA_CONVERSION.md.

Local Development Setup

For more details on how to integrate this library into your project without npm publishing, see LOCAL_DEVELOPMENT.md.