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

astro-broken-links-checker

v1.0.6

Published

An Astro integration to check for broken links in your website during development and build time.

Readme

Astro Broken Links Checker

An Astro integration that checks for broken links in your website during static build. It logs any broken links to the console and writes them to a file, grouping them by the document in which they occur.

Goals

  • Checks Internal and External Links: Validates all <a href="..."> links found in your HTML pages.
  • Logs Broken Links: Outputs broken link information to both the console and a log file.
  • Grouped by broken URL: To allow for quick search and replacement, a list of all pages containing the broken URL is logged.
  • Caching Mechanism: Avoids redundant checks by caching the results of previously checked links, both internal and external, whether they are valid or not.
  • Parallel Processing: Checks links and does IO and network operations in parallel to improve performance. We first collect all links from all pages, then only check each once, first loading the tsv cache, then saving it again when we are done. All http requests happen in parallel.
  • Local redirect awareness: If a link is redirected in astro.config.mjs, it will be followed.
  • Timeouts and retries: To avoid false positives, links that fail to load with ECONNRESET are retried 3 times with exponential backoff. Timeouts are set to 3 second max including retries.
  • Link text preservation: The contents of "href" are only normalized to a domain-relative path (like /foo/bar/) if they are "../relative" or "./relative" or "relative" etc. It is otherwise preserved for reporting purposes.
  • Cross-platform compatibility: The physical paths of the html files are normalized to domain relative paths.
  • Disk caching of remote links: To speed up subsequent builds, a tab-delimited text file is optionally written to disk containing the contents of all remote links checked and the status code returned by the server, in the form URLok/failedstatus codeISO-8601-formatted timestamp.

Installation

Install the package using npm:

npm install astro-broken-links-checker

[!NOTE] You can also install from GitHub if you need the latest development version:

  "dependencies": {
    "astro": "5.16.6",
    "astro-broken-links-checker": "imazen/astro-broken-link-checker"
  }

Finally, update your astro.config.mjs

import { defineConfig } from 'astro/config';
import astroBrokenLinksChecker from 'astro-broken-link-checker';

export default defineConfig({
  // ... other configurations ...
  integrations: [
    astroBrokenLinksChecker({
      logFilePath: 'broken-links.log', // Optional: specify the log file path
      checkExternalLinks: false, // Optional: check external links (currently, caching to disk is not supported, and it is slow)
      throwError: true // Optional: throw an error to fail the build if broken links are found. Defaults to false.
    }),
  ],
});