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

@smurfy92/product-graph

v0.7.0

Published

Product graph analyzer CLI — extract product facts (user stories, domains, pages, API endpoints, migrations, i18n keys, tests) and enforce Datalog rules on them. Inspired by codegraph-toolkit but for the product layer.

Readme

@smurfy92/product-graph

npm license: MIT

Product graph analyzer for software projects. Extracts product facts (user stories, domains, pages, API endpoints, DB tables, i18n keys, tests) from a codebase and runs Datalog rules over them, with a ratchet baseline that blocks new violations.

Inspired by codegraph-toolkit, but for the product layer instead of the code layer.

Install

npm install --save-dev @smurfy92/product-graph @smurfy92/product-invariants

Then create a product-graph.config.json at the project root:

{
  "project": "Acme",
  "sourceRoot": ".",
  "paths": {
    "docs": "docs/product",
    "appRouter": "src/app",
    "migrations": "supabase/migrations",
    "tests": ["src", "e2e"],
    "i18n": "src/i18n"
  },
  "domains": [
    { "id": "auth", "name": "Auth", "status": "critical" },
    { "id": "billing", "name": "Billing", "status": "production" }
  ]
}

Usage

# Extract product facts to .productgraph/facts/
npx product-graph analyze --config product-graph.config.json

# Run Datalog rules + ratchet baseline check (exits 1 if new violations)
npx product-graph check --config product-graph.config.json

# Lock current violations as the new baseline floor
npx product-graph baseline --config product-graph.config.json

# Generate a 3-level markdown brief
npx product-graph synopsis --config product-graph.config.json

Concepts

| Concept | What it means | |---|---| | Fact | A tuple destined for a Datalog relation. Stored as TSV in .productgraph/facts/<Relation>.facts. | | Rule | A Datalog statement (.dl) that derives Violation(...) tuples from facts. | | Baseline | JSON file pinning current violations as the new floor. New violations break CI. | | Synopsis | Auto-generated 3-level Markdown brief: Domain → Stories → Source files. |

User-story binding

Write user stories in docs/product/<domain>.md with frontmatter:

---
domain: auth
stories:
  - id: auth.signup
    text: "Visitor can create an account"
    path: /auth/signup
  - id: auth.delete-account
    text: "User can delete account (RGPD)"
    api: /api/account/delete
---

The path: and api: fields are what no-orphan-story and no-untested-critical rules join on. Stories without either are reported as orphans (legitimate transverse concerns can be OrphanStoryGrandfathered'd in a local .dl file).

Architecture

extractors → facts NDJSON (TSV) → @smurfy92/datalog → Violations → ratchet baseline
                ↘ synopsis Markdown 3-level

Seven extractors ship by default:

  • markdown-frontmatter → UserStory(id, domain, text, file, line)
  • story-routes-binding → StoryRefsPage(...), StoryRefsApi(...)
  • nextjs-routes → Page(path, file)
  • api-routes → ApiEndpoint(method, path, file)
  • supabase-migrations → Table(...), RlsPolicy(...), Migration(...)
  • test-coverage → Test(file, kind, target)
  • i18n-keys → TranslationKey(locale, key, file)

Rules

See @smurfy92/product-invariants for the rule catalogue.

Programmatic API

import { analyze, loadConfig, buildSynopsis } from "@smurfy92/product-graph";

const { config, projectRoot } = loadConfig("./product-graph.config.json");
const result = await analyze(projectRoot, config);
console.log(result.emitted);

License

MIT. See LICENSE.