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-inference

v0.2.6

Published

Astro integration that auto-generates LLM-friendly text/plain pages and llms.txt for your site

Readme

astro-inference

npm version npm downloads license

Astro integration that automatically generates LLM-friendly pages for your site.

Adds two routes to any Astro project:

  • /llms.txt — structured plain-text index of your site, following the llms.txt standard
  • /[page]/machine.txt — clean text/plain markdown version of any page, optimized for LLM consumption

Installation

pnpm add astro-inference
# or
npm install astro-inference
# or
yarn add astro-inference

Setup

// astro.config.mjs
import { defineConfig } from 'astro/config';
import astroInference from 'astro-inference';

export default defineConfig({
  integrations: [
    astroInference({
      siteName: 'My Site',
      siteDescription: 'What my site does in one sentence.',
    }),
  ],
});

That's it. No other configuration required.

Routes

/llms.txt

A machine-readable index of your entire site. Grouped by content collection, with titles and descriptions pulled from front matter.

# My Site
> What my site does in one sentence.

## Blog

- [Getting started](https://mysite.com/blog/getting-started) - A quick intro
- [Another post](https://mysite.com/blog/another-post)

## Machine-readable pages

Each page on this site has a plain-text version at `[page-url]/machine.txt`.
Example: `https://mysite.com/about/machine.txt`

/[page]/machine.txt

A plain-text markdown version of any page. Scripts, styles, and footer are removed. Navigation links are preserved at the bottom so LLMs can traverse the site.

# My Site
> Source: https://mysite.com/about
> Machine-readable version - 2026-04-07

---

# About Us

We build great things for great people.

## Our values

- Honesty
- Speed
- Quality

## Navigation

- [Home](/)
- [About](/about)
- [Blog](/blog)
- [Contact](/contact)

---
Generated by astro-inference | https://mysite.com/llms.txt

Works for any route: /about/machine.txt, /blog/my-post/machine.txt, /docs/guide/machine.txt.

Content Filtering

The following are automatically removed from machine.txt output:

  • <script>, <style>, <head> — no code or styling
  • <footer>, <aside> — peripheral content
  • <header> — visual branding
  • Skip-to-content links (e.g. #main-content, Skip to navigation) — accessibility anchors irrelevant to LLMs

Navigation links from <nav> elements are not removed — they are extracted and placed in a ## Navigation section at the bottom, so LLMs can follow links to other pages on the site. Duplicate links are deduplicated automatically.

Options

| Option | Type | Default | Description | | ----------------- | ---------- | ------------- | ------------------------------------------------------- | | siteName | string | hostname | Heading used in llms.txt | | siteDescription | string | — | One-line tagline shown below the heading | | exclude | string[] | [] | Paths to exclude. Supports /* wildcard suffix. | | collections | string[] | auto-detected | Content collection names to include in llms.txt | | llmsTxtPath | string | /llms.txt | Where llms.txt is served | | machineSuffix | string | machine.txt | Suffix appended to each page route | | attribution | boolean | true | Include footer in output. Set to false to remove it entirely. | | customFooter | string | — | Replace the default footer text with your own string. |

Removing or customizing the footer

By default every output file ends with:

---
Generated by astro-inference | https://yoursite.com/llms.txt

Remove it entirely:

astroInference({
  attribution: false,
})

Or replace it with your own text:

astroInference({
  customFooter: 'Built with ❤️ by Acme Corp',
})

Both options affect /llms.txt and every /[page]/machine.txt file.

Example with all options

astroInference({
  siteName: 'Acme Corp',
  siteDescription: 'We make the best widgets on the internet.',
  exclude: ['/admin/*', '/private', '/thank-you'],
  collections: ['blog', 'docs'],
  llmsTxtPath: '/llms.txt',
  machineSuffix: 'machine.txt',
  attribution: true,
  customFooter: 'Built with ❤️ by Acme Corp',
})

Content Collections

If your project uses Astro Content Collections, astro-inference picks them up automatically.

Default collection names scanned: blog, posts, articles, pages, docs, work, projects, portfolio, news, events.

Use the collections option to specify exactly which collections to include — this avoids warnings for non-existent collections and gives you explicit control.

Front matter fields used:

| Field | Used in | | -------------------------- | ----------------------------------- | | title | Link label in llms.txt | | description or summary | Description after in llms.txt |

How It Works

  1. On astro:config:setup, /llms.txt is injected via injectRoute() and machine.txt routes are handled via Astro middleware.
  2. /llms.txt reads your content collections at request time and builds a grouped markdown index.
  3. /[...slug]/machine.txt fetches the original page HTML, strips non-semantic elements, extracts navigation links, and converts the remainder to clean markdown.

No build-time scanning, no filesystem crawling — everything runs through Astro's existing request pipeline.

Requirements

  • Astro 4.0 or later
  • Node.js 18 or later

License

MIT