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

@chrisballam/llms-txt-generator

v1.0.1

Published

Generate llms.txt and llms-full.txt files for your website so AI answer engines (ChatGPT, Claude, Perplexity, Google AI Overviews) can discover and cite your content.

Readme

llms-txt-generator

npm version CI license node

Created by Chris Ballam.

Generate llms.txt and llms-full.txt for any website so AI answer engines — ChatGPT, Claude, Perplexity, Google AI Overviews, and others — can discover, understand, and cite your content.

  • Zero runtime dependencies. Uses only the Node.js standard library (built-in fetch, node:util, node:test). Nothing to audit, nothing to npm audit.
  • Sitemap-first, crawl-fallback. Reads sitemap.xml (including sitemap indexes); if none exists, it does a bounded same-origin crawl.
  • Both files. Produces the compact llms.txt index and the expanded llms-full.txt with full page text.
  • Usable as a CLI or a library.

What is llms.txt?

llms.txt is a proposed convention — a single Markdown file at the root of your domain (/llms.txt) that gives large language models a clean, curated map of your site: a title, a short summary, and grouped links with descriptions. llms-full.txt goes further and inlines the actual page text so a model can answer from your content without crawling every page.

It is to AI answer engines roughly what sitemap.xml and robots.txt are to search crawlers.

Note: llms.txt is an emerging convention, not a guaranteed ranking signal. Treat it as one clean, low-cost input to your GEO/AEO strategy — not a silver bullet. Google Search does not consume it today.

Requirements

Node.js >= 18.17 (for a stable built-in fetch and node:test).

Install

Run without installing:

npx @chrisballam/llms-txt-generator https://example.com

Or install globally (the command is llms-txt):

npm install -g @chrisballam/llms-txt-generator
llms-txt https://example.com

Or add to a project:

npm install @chrisballam/llms-txt-generator

CLI usage

# Simplest case — writes ./llms.txt
llms-txt https://example.com

# Also write llms-full.txt, into ./public
llms-txt https://example.com --full --out public

# Skip noisy URLs
llms-txt https://example.com --exclude "*/tag/*" --exclude "*/author/*" --exclude "*?*"

# Print to stdout instead of writing files (pipe it somewhere)
llms-txt https://example.com --stdout > llms.txt

# Drive everything from a config file
llms-txt --config llms-txt.config.json

Options

| Flag | Description | Default | |------|-------------|---------| | -c, --config <path> | Load options from a JSON file. | — | | -o, --out <dir> | Output directory. | . | | -m, --max <n> | Max pages to include. | 100 | | -f, --full | Also write llms-full.txt. | off | | --sitemap <url> | Explicit sitemap URL. | <site>/sitemap.xml | | --title <str> | Title for the generated files. | site hostname | | --summary <str> | One-line summary (blockquote). | first page description | | --include <glob> | Only keep matching URLs (repeatable). | — | | --exclude <glob> | Drop matching URLs (repeatable). | — | | --concurrency <n> | Parallel fetches. | 5 | | --timeout <ms> | Per-request timeout. | 15000 | | --stdout | Print llms.txt to stdout. | off | | -q, --quiet | Suppress progress logging. | off | | -h, --help | Show help. | — | | -v, --version | Show version. | — |

Globs support * and ?; a pattern with no wildcard is treated as a substring match.

Config file

CLI flags override config-file values. See llms-txt.config.example.json:

{
  "site": "https://example.com",
  "title": "Example Company",
  "summary": "Example Company builds widgets that make your workflow faster.",
  "full": true,
  "outDir": "public",
  "maxPages": 200,
  "exclude": ["*/tag/*", "*/author/*", "*?*"]
}

Programmatic API

generate() returns the file contents; it does not write to disk, so you can post-process or write them yourself.

import { generate } from '@chrisballam/llms-txt-generator';

const { llmsTxt, llmsFullTxt, pages, failures } = await generate({
  site: 'https://example.com',
  full: true,
  exclude: ['*/tag/*'],
});

console.log(llmsTxt);          // the compact index
console.log(pages.length);     // pages successfully processed
console.log(failures);         // [{ url, status, error }]

You can inject a custom fetcher (handy for testing or for adding auth headers):

await generate({ site: 'https://example.com' }, {
  fetcher: async (url) => ({ ok: true, status: 200, contentType: 'text/html', body: '<title>Hi</title>' }),
  log: (msg) => console.error(msg),
});

Lower-level building blocks are exported too: fetchUrl, discoverFromSitemap, crawlSite, extractPage, htmlToText, renderLlmsTxt, renderLlmsFullTxt.

Output shape

llms.txt:

# example.com

> Example Company builds widgets that make your workflow faster.

## Pages

- [Home](https://example.com/): The home page.

## Blog

- [Hello world](https://example.com/blog/hello): Our first post.

llms-full.txt uses the same header, then appends each page's full extracted text under a ## Title / Source: block.

How to deploy it

  1. Run the generator and write llms.txt (and optionally llms-full.txt) to your web root.
  2. Serve them at https://yourdomain.com/llms.txt and https://yourdomain.com/llms-full.txt as text/plain or text/markdown.
  3. Regenerate on each deploy (a CI step or cron) so the files stay in sync with your content.

Development

git clone https://github.com/chrisballam/llms-txt-generator.git
cd llms-txt-generator
node --test        # run the test suite (no install needed)

There are no dependencies to install — tests run straight from a clean checkout.

Contributing

Issues and PRs welcome. Please keep the zero-dependency constraint: standard library only.

License

MIT © Chris Ballam