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

@aiedx/fetchlens-cloudflare

v0.1.2

Published

AI bot detection middleware for Cloudflare Workers & Pages — detect 26+ AI crawlers at the edge

Downloads

328

Readme

@aiedx/fetchlens-cloudflare

AI bot detection middleware for Cloudflare Workers & Pages. Detects 26+ AI agents (GPTBot, ClaudeBot, PerplexityBot, and more) hitting your site in real-time at the edge.

Why

Google Analytics, Plausible, and every other analytics tool are 100% blind to AI bot traffic. These bots don't run JavaScript, so they never appear in your dashboards. FetchLens detects them at the edge before they even reach your origin.

Install

npm install @aiedx/fetchlens-cloudflare

Setup — Cloudflare Pages

Add functions/_middleware.ts to your project:

import { createPagesMiddleware } from '@aiedx/fetchlens-cloudflare'

export const onRequest = createPagesMiddleware({
  siteId: 'yourdomain.com',
  apiEndpoint: 'https://fetchlens.ai',
  siteTag: 'fl_pub_your_key',
})

That's it. Every request to your Pages site now runs through FetchLens.

Setup — Cloudflare Workers

Use withFetchLens as your Worker's default export:

import { withFetchLens } from '@aiedx/fetchlens-cloudflare'

export default withFetchLens({
  siteId: 'yourdomain.com',
  apiEndpoint: 'https://fetchlens.ai',
  siteTag: 'fl_pub_your_key',
})

Get your Site Tag by scanning your domain at fetchlens.ai.

What it detects

| Provider | Bots | |----------|------| | OpenAI | GPTBot, ChatGPT-User, OAI-SearchBot | | Anthropic | ClaudeBot, Claude-SearchBot, Claude-User, Claude-Code, anthropic-ai | | Perplexity | PerplexityBot, Perplexity-User | | Google | Google-Extended, Google-CloudVertexBot | | Apple | Applebot-Extended | | Meta | meta-externalagent, meta-externalfetcher, FacebookBot | | Others | DuckAssistBot, MistralAI-User, Bytespider, cohere-ai, Amazonbot, PetalBot, Diffbot, PhindBot, YouBot, CCBot |

Features

  • Zero-latency — detection runs asynchronously via waitUntil, no impact on page load
  • Vulnerability scan blocking — automatically blocks probes for .php, /wp-admin, .env, etc. with a 403 (configurable)
  • Edge-native — runs on Cloudflare's global network, 300+ PoPs
  • Works with any origin — static sites, GitHub Pages, R2, or any backend
  • 26+ AI bot signatures — covers all major AI crawlers and training bots

Configuration

createPagesMiddleware({
  siteId: 'yourdomain.com',        // Required: your domain
  apiEndpoint: 'https://fetchlens.ai', // Required: FetchLens API URL
  siteTag: 'fl_pub_xxx',           // Your Site Tag (from install guide)
  blockVulnScans: true,            // Block vulnerability probes (default: true)
  detectReferrals: true,           // Detect AI referrals via Referer/UTM (default: true)
})

How it works

  1. Every request passes through Cloudflare's edge
  2. FetchLens extracts the user agent, headers, geo, and request metadata
  3. The payload is sent asynchronously to the FetchLens API (zero latency impact via waitUntil)
  4. The API identifies the bot using 26+ known signatures + heuristic detection
  5. Results appear on your FetchLens dashboard

Also add the client snippet

For AI referral detection (when users click links from ChatGPT, Claude, etc.), add the JS snippet to your HTML <head>:

<script src="https://fetchlens.ai/fetchlens.js" data-key="fl_pub_your_key" defer></script>

The middleware catches bots (server-side), the snippet catches referrals (client-side). Together they give you the full picture.

Requirements

  • Cloudflare Workers or Pages project
  • Node.js 18+

License

Proprietary. Copyright (c) 2026 AIEDX Private Limited.