{"_id":"@aiedx/fetchlens-cloudflare","_rev":"3-48959e201010b0e96fb3a3b5cd2785bb","name":"@aiedx/fetchlens-cloudflare","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@aiedx/fetchlens-cloudflare","version":"0.1.0","keywords":["cloudflare","workers","pages","middleware","ai","bot-detection","fetchlens","analytics","edge"],"author":{"name":"AIEDX Private Limited"},"license":"SEE LICENSE IN LICENSE","_id":"@aiedx/fetchlens-cloudflare@0.1.0","maintainers":[{"name":"adssidhu86","email":"aiedx.org@gmail.com"}],"homepage":"https://fetchlens.ai","dist":{"shasum":"90883b6d243fb9eab056e5d1a40f19b92f619878","tarball":"https://registry.npmjs.org/@aiedx/fetchlens-cloudflare/-/fetchlens-cloudflare-0.1.0.tgz","fileCount":7,"integrity":"sha512-oK3Nj3tkmm7XkPycCQt1fBQCJcFWmjY30cXW7Rlw5qG70t3etGlyBxISpq0Ju67+rppRDkuMWdOiz9c6Cy4y7w==","signatures":[{"sig":"MEUCIQDyHE0krPR1pkX8uhnuKYWq9M5erDR2aJVtXtU8xTEtJgIgTxKP3/sVyCcKYDzF8U5pMowL74l3Ru9K+CBf79s+TDo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17014},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"8f30427882ac23ff5baca9d2b610fd1cd5f0ebc3","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts --clean"},"_npmUser":{"name":"adssidhu86","email":"aiedx.org@gmail.com"},"_npmVersion":"10.7.0","description":"AI bot detection middleware for Cloudflare Workers & Pages — detect 26+ AI crawlers at the edge","directories":{},"_nodeVersion":"22.2.0","dependencies":{"@aiedx/fetchlens-core":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@cloudflare/workers-types":"^4.20250410.0"},"_npmOperationalInternal":{"tmp":"tmp/fetchlens-cloudflare_0.1.0_1776290054053_0.8849816694495194","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aiedx/fetchlens-cloudflare","version":"0.1.1","keywords":["cloudflare","workers","pages","middleware","ai","bot-detection","fetchlens","analytics","edge"],"author":{"name":"AIEDX Private Limited"},"license":"SEE LICENSE IN LICENSE","_id":"@aiedx/fetchlens-cloudflare@0.1.1","maintainers":[{"name":"adssidhu86","email":"aiedx.org@gmail.com"}],"homepage":"https://fetchlens.ai","dist":{"shasum":"6282d1a677750f7077e2822d1f2151b80d5b4a71","tarball":"https://registry.npmjs.org/@aiedx/fetchlens-cloudflare/-/fetchlens-cloudflare-0.1.1.tgz","fileCount":7,"integrity":"sha512-BihHf7NMQkHm8YDz8j7sj3kd67uMHCTIeEBA57mfMuMuf67n8qvk8YeDIxK2j5E+a4orrDMt41K3od/EQ7PQYg==","signatures":[{"sig":"MEQCIHzCAVVqg1KzJIxx0bRz3AuQrcwBSZcHmNyLzseX+rw4AiBLpmeOHoem2fNpgzXFdsXM0x40tevVBHawlrGD4zuygw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17014},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"8f30427882ac23ff5baca9d2b610fd1cd5f0ebc3","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts --clean"},"_npmUser":{"name":"adssidhu86","email":"aiedx.org@gmail.com"},"_npmVersion":"10.7.0","description":"AI bot detection middleware for Cloudflare Workers & Pages — detect 26+ AI crawlers at the edge","directories":{},"_nodeVersion":"22.2.0","dependencies":{"@aiedx/fetchlens-core":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@cloudflare/workers-types":"^4.20250410.0"},"_npmOperationalInternal":{"tmp":"tmp/fetchlens-cloudflare_0.1.1_1776290538979_0.7207612092479028","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aiedx/fetchlens-cloudflare","version":"0.1.2","description":"AI bot detection middleware for Cloudflare Workers & Pages — detect 26+ AI crawlers at the edge","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts --format cjs,esm --dts --watch"},"dependencies":{"@aiedx/fetchlens-core":"^0.1.2"},"devDependencies":{"@cloudflare/workers-types":"^4.20250410.0","tsup":"^8.5.1","typescript":"^5.9.3"},"keywords":["cloudflare","workers","pages","middleware","ai","bot-detection","fetchlens","analytics","edge"],"author":{"name":"AIEDX Private Limited"},"license":"SEE LICENSE IN LICENSE","homepage":"https://fetchlens.ai","_id":"@aiedx/fetchlens-cloudflare@0.1.2","gitHead":"5839ca96e4f896ed071d101a1cf96bf69be985b9","_nodeVersion":"22.2.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-cGowJsRVW99r2kiHkiMWVw4huxdgrMdEzsYoQc2Clek9eDrJAwplu/dfhDGtCURBiTyOgt6qm4zezdzjdLu1cQ==","shasum":"ac29a87f634a21105a516888079252e4f139511e","tarball":"https://registry.npmjs.org/@aiedx/fetchlens-cloudflare/-/fetchlens-cloudflare-0.1.2.tgz","fileCount":7,"unpackedSize":17847,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDb9B9PzCSOpuy6868tovm20LyFGyJdToxEHHU1KIXTBQIhAMsBswwK6s3jLekuMFLLFExtGweIoAH97CjF4DpmV3HM"}]},"_npmUser":{"name":"adssidhu86","email":"aiedx.org@gmail.com"},"directories":{},"maintainers":[{"name":"adssidhu86","email":"aiedx.org@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fetchlens-cloudflare_0.1.2_1776963439533_0.8416526764034886"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-15T21:54:13.927Z","modified":"2026-04-23T16:57:19.835Z","0.1.0":"2026-04-15T21:54:14.204Z","0.1.1":"2026-04-15T22:02:19.126Z","0.1.2":"2026-04-23T16:57:19.672Z"},"author":{"name":"AIEDX Private Limited"},"license":"SEE LICENSE IN LICENSE","homepage":"https://fetchlens.ai","keywords":["cloudflare","workers","pages","middleware","ai","bot-detection","fetchlens","analytics","edge"],"description":"AI bot detection middleware for Cloudflare Workers & Pages — detect 26+ AI crawlers at the edge","maintainers":[{"name":"adssidhu86","email":"aiedx.org@gmail.com"}],"readme":"# @aiedx/fetchlens-cloudflare\n\nAI 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.\n\n## Why\n\nGoogle 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.\n\n## Install\n\n```bash\nnpm install @aiedx/fetchlens-cloudflare\n```\n\n## Setup — Cloudflare Pages\n\nAdd `functions/_middleware.ts` to your project:\n\n```typescript\nimport { createPagesMiddleware } from '@aiedx/fetchlens-cloudflare'\n\nexport const onRequest = createPagesMiddleware({\n  siteId: 'yourdomain.com',\n  apiEndpoint: 'https://fetchlens.ai',\n  siteTag: 'fl_pub_your_key',\n})\n```\n\nThat's it. Every request to your Pages site now runs through FetchLens.\n\n## Setup — Cloudflare Workers\n\nUse `withFetchLens` as your Worker's default export:\n\n```typescript\nimport { withFetchLens } from '@aiedx/fetchlens-cloudflare'\n\nexport default withFetchLens({\n  siteId: 'yourdomain.com',\n  apiEndpoint: 'https://fetchlens.ai',\n  siteTag: 'fl_pub_your_key',\n})\n```\n\nGet your Site Tag by scanning your domain at [fetchlens.ai](https://fetchlens.ai).\n\n## What it detects\n\n| Provider | Bots |\n|----------|------|\n| OpenAI | GPTBot, ChatGPT-User, OAI-SearchBot |\n| Anthropic | ClaudeBot, Claude-SearchBot, Claude-User, Claude-Code, anthropic-ai |\n| Perplexity | PerplexityBot, Perplexity-User |\n| Google | Google-Extended, Google-CloudVertexBot |\n| Apple | Applebot-Extended |\n| Meta | meta-externalagent, meta-externalfetcher, FacebookBot |\n| Others | DuckAssistBot, MistralAI-User, Bytespider, cohere-ai, Amazonbot, PetalBot, Diffbot, PhindBot, YouBot, CCBot |\n\n## Features\n\n- **Zero-latency** — detection runs asynchronously via `waitUntil`, no impact on page load\n- **Vulnerability scan blocking** — automatically blocks probes for `.php`, `/wp-admin`, `.env`, etc. with a 403 (configurable)\n- **Edge-native** — runs on Cloudflare's global network, 300+ PoPs\n- **Works with any origin** — static sites, GitHub Pages, R2, or any backend\n- **26+ AI bot signatures** — covers all major AI crawlers and training bots\n\n## Configuration\n\n```typescript\ncreatePagesMiddleware({\n  siteId: 'yourdomain.com',        // Required: your domain\n  apiEndpoint: 'https://fetchlens.ai', // Required: FetchLens API URL\n  siteTag: 'fl_pub_xxx',           // Your Site Tag (from install guide)\n  blockVulnScans: true,            // Block vulnerability probes (default: true)\n  detectReferrals: true,           // Detect AI referrals via Referer/UTM (default: true)\n})\n```\n\n## How it works\n\n1. Every request passes through Cloudflare's edge\n2. FetchLens extracts the user agent, headers, geo, and request metadata\n3. The payload is sent asynchronously to the FetchLens API (zero latency impact via `waitUntil`)\n4. The API identifies the bot using 26+ known signatures + heuristic detection\n5. Results appear on your [FetchLens dashboard](https://fetchlens.ai/dashboard)\n\n## Also add the client snippet\n\nFor **AI referral detection** (when users click links from ChatGPT, Claude, etc.), add the JS snippet to your HTML `<head>`:\n\n```html\n<script src=\"https://fetchlens.ai/fetchlens.js\" data-key=\"fl_pub_your_key\" defer></script>\n```\n\nThe middleware catches bots (server-side), the snippet catches referrals (client-side). Together they give you the full picture.\n\n## Requirements\n\n- Cloudflare Workers or Pages project\n- Node.js 18+\n\n## License\n\nProprietary. Copyright (c) 2026 AIEDX Private Limited.\n","readmeFilename":"README.md"}