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

linkrot

v0.1.0

Published

Find broken links and orphan pages in a folder of markdown — for docs sites, ADRs, and Obsidian-style vaults.

Readme

linkrot

Find broken links and orphan pages in a folder of markdown — docs sites, ADR directories, wikis, or an Obsidian vault. One command, no config, no network, zero runtime dependencies.

$ npx linkrot ./docs
linkrot — 42 markdown files scanned
  links: 118 total, 115 resolved, 3 broken
  orphans (nothing links to them): 4

Broken links (3):
  ✗ guides/setup.md:12  →  ./instal.md          [missing file]
  ✗ api/index.md:30     →  ../reference/v2.md   [missing file]
  ✗ notes/ideas.md:5    →  Old Roadmap          [no note matches]

Orphans (4):
  • drafts/scratch.md (isolated)
  • archive/2019.md
  ...

It exits non-zero when it finds a problem, so it drops straight into CI to keep a docs folder honest as it grows.

Why

Docs rot. Files get renamed, notes get deleted, and the links pointing at them go quietly stale. linkrot is the smallest possible tool that catches that: point it at a directory, get the broken links and the pages nothing connects to.

Install

npm install -g linkrot
# or run without installing:
npx linkrot ./your-docs
bunx linkrot ./your-docs

Requires Node.js 18+ (or Bun).

Usage

linkrot [dir] [options]

  dir               directory to scan (default: current directory)
  --json            print the full link graph as JSON
  --html <file>     write a self-contained interactive graph viewer
  --images          treat image links as edges (also checks image paths)
  --no-orphans      report/fail on broken links only, ignore orphans
  --quiet           no output on success (for CI)
  -h, --help        show help

What it understands

| Link form | Example | Resolution | |-----------|---------|------------| | Inline | [text](./other.md) | relative to the file; .md is inferred if omitted | | Image | ![alt](./diagram.png) | only with --images | | Wikilink | [[Other Note]] / [[Note\|alias]] | by note name, Obsidian-style | | Directory | [logs](./logs/) | valid if the folder exists |

It deliberately ignores: external URLs (http, mailto, //cdn…), in-page anchors (#section), and anything inside fenced or inline code spans.

Interactive graph

npx linkrot ./docs --html graph.html

writes a single self-contained HTML file — a force-directed map of your documents with broken links and orphans listed alongside. No build step, no CDN, open it in any browser.

Use in CI

- run: npx linkrot ./docs --quiet --no-orphans

Fails the job the moment a doc link points at nothing.

Programmatic API

import { loadDir, listDirs, buildGraph, formatReport } from 'linkrot';

const files = loadDir('./docs');
const graph = buildGraph(files, { knownDirs: listDirs('./docs') });
console.log(formatReport(graph));
console.log(graph.broken);   // [{ from, target, line, kind, reason }]
console.log(graph.orphans);  // GraphNode[]

The parse and graph layers are pure functions with no filesystem access, so they are easy to test and embed.

License

MIT.