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

indiestack-ai-bots

v0.1.2

Published

Server-side AI bot tracking for indiestack analytics. Detects AI assistants, AI search systems and training crawlers requesting pages on your site — from Next.js proxy, Cloudflare Workers/Pages, Express, Hono or any web-standard handler.

Readme

indiestack-ai-bots

Server-side AI bot tracking for indiestack analytics. Detect when AI assistants, AI search systems and training crawlers request pages on your site — from Next.js proxy, Cloudflare Workers/Pages, Express, Hono, or any web-standard handler.

Zero dependencies. Non-blocking (uses waitUntil when the runtime offers it).

Install

npm install indiestack-ai-bots

Usage

Next.js (proxy.ts / middleware)

import { trackAIBotRequest, type NextRequestWithWaitUntil } from "indiestack-ai-bots";

export async function proxy(request: NextRequestWithWaitUntil) {
  await trackAIBotRequest(request, request, {
    websiteId: process.env.INDIESTACK_SITE_ID!,
  });
  return NextResponse.next();
}

Cloudflare Workers / Pages

import { withAIBotTracking } from "indiestack-ai-bots";

export default {
  fetch: withAIBotTracking(myHandler, { websiteId: "your-site-token" }),
};

Hono / Express / anything else

import { trackAIBotRequest } from "indiestack-ai-bots";

app.use(async (req, res, next) => {
  await trackAIBotRequest(req as unknown as Request, undefined, { websiteId: "your-site-token" });
  next();
});

How it works

  1. The package pre-filters locally: only requests whose user-agent matches a known AI bot (GPTBot, ClaudeBot, PerplexityBot, OAI-SearchBot, Bytespider, Google-Extended, …) on document paths (robots.txt, llms.txt, sitemap.xml included) produce an event. Human traffic and static assets never leave your server.
  2. A small event (path, hostname, user-agent, status code, crawler IP) is shipped to your indiestack worker — the worker is the source of truth for provider classification, category (answer_fetch / search_index / training / ai_crawler), and IP verification against vendor-published ranges. Bot lists update server-side; no SDK upgrades needed.
  3. The visitor-facing analytics never see this traffic — it lives in its own crawler log.

Options

| Option | Type | Description | |---|---|---| | websiteId | string | Required. Your analytics site token (data-site value). | | endpoint | string | Override the indiestack worker origin (self-hosting). | | authToken | string | Optional secret, sent as x-indiestack-token. | | publicOrigin | string | Tracked site origin when the runtime can't derive it. | | onEvent | function | Local sink instead of HTTP delivery — useful for self-tracking inside the indiestack worker itself. |

Categories

| Category | Meaning | Example agents | |---|---|---| | answer_fetch | Fetching a page to answer a user right now | ChatGPT-User, Claude-User, Perplexity-User | | search_index | Indexing for AI search results | OAI-SearchBot, PerplexityBot, Googlebot | | training | Collecting data for model training | GPTBot, ClaudeBot, Bytespider, CCBot | | ai_crawler | Other/uncategorized AI fetches | — |