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

@opencosmos/constellation

v0.1.0

Published

Living knowledge-graph visualizer for OpenCosmos. A React wrapper around @cosmos.gl/graph (MIT) that renders tradition · work · section · quote tiers as a navigable starfield.

Downloads

27

Readme

@opencosmos/constellation

Living knowledge-graph visualizer for OpenCosmos. A React wrapper around @cosmos.gl/graph (MIT) that renders tradition · work · section · quote tiers as a navigable starfield.

Status: alpha — labels + tier-aware LOD landed; ambient motion, focus targeting, and theme integration coming next.

Install

pnpm add @opencosmos/constellation

Peer requirements: react ^18 || ^19.

Usage

'use client'

import dynamic from 'next/dynamic'

// SSR off — the renderer creates a WebGL context on mount.
const KnowledgeGraph = dynamic(
  () => import('@opencosmos/constellation').then((m) => m.KnowledgeGraph),
  { ssr: false },
)

export default function Page() {
  const [data, setData] = useState(null)

  useEffect(() => {
    fetch('/api/knowledge/constellation').then((r) => r.json()).then(setData)
  }, [])

  if (!data) return null
  return (
    <div className="h-screen w-screen">
      <KnowledgeGraph
        data={data}
        onNodeClick={(id) => console.log('clicked', id)}
        className="h-full w-full"
      />
    </div>
  )
}

Data shape

type Tier = 'tradition' | 'work' | 'section' | 'quote'

interface ConstellationNode {
  id: string
  tier: Tier
  label: string
  x: number
  y: number
  // optional: domain, tradition, author, parent, category, provenanceStatus, degree
}

interface ConstellationLink {
  source: string  // node id
  target: string  // node id
  type:   'hierarchy' | 'contains' | 'cites' | 'member_of'
}

interface ConstellationData {
  nodes: ConstellationNode[]
  links: ConstellationLink[]
  generatedAt: number
}

The generator that produces this shape lives at scripts/knowledge/generate-constellation-graph.ts in the OpenCosmos consumer repo.

What's in the current alpha

  • <KnowledgeGraph data={...}> mounts @cosmos.gl/graph and renders nodes + links from typed Float32 arrays.
  • Tier-aware default colors and sizes (override via tierColors / tierSizes props).
  • Built-in force simulation is disabled — the component honors the pre-computed positions from the generator's ForceAtlas2 pass.
  • HTML label overlay with tier-aware LOD: traditions are always labeled, works/sections/quotes resolve as the user zooms in. Labels are sampled (cosmos.gl's pointSamplingDistance controls density), so density stays manageable at every zoom level. Override per tier via lodVisibility={{ tradition: 0, work: 1.5, section: 3, quote: 6 }} or disable entirely with showLabels={false}.
  • onNodeClick(id) callback fires with the node's id (not its index).
  • onZoomChange(zoom) callback fires on every pan/zoom event for consumer-side legends/mini-maps. Throttle in the consumer if your UI is expensive to re-render.
  • fitView() runs once on first ready so the entire constellation is visible.

What's coming

| Feature | Target | |---|---| | Ambient drift respecting prefers-reduced-motion | next | | Programmatic zoom-to-context (focus={nodeId}) | next | | @opencosmos/tokens theme integration | after focus + motion | | Edge opacity scaling with zoom | nice-to-have | | Label collision avoidance | post-1.0 |

License

MIT — same as the underlying @cosmos.gl/graph engine.