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

coonlink-manyersuchapita

v26.1.4

Published

Next.js middleware + 404 tracker: progressive IP ban for scanners/probers

Readme

coonlink-ManYerSuchAPita

Next.js middleware + 404 tracker: progressive IP ban for scanners/probers.

How it works

  • Probe paths and suspicious User-Agents are scored 0–100
  • Rules load automatically from GitHub (updated without republishing)
  • 5 hits → YouTube redirect
  • 12 hits → 5h temp ban (KV TTL, auto-expires)
  • Return after ban + 5 hits → permanent Cloudflare Firewall ban

Setup

1. Environment variables

CF_API_TOKEN=your_cloudflare_api_token
CF_ZONE_ID=your_zone_id

2. Config (lib/guard.ts)

import { createMemoryStore, createUpstashStore } from "coonlink-manyersuchapita"
import { kv } from "@vercel/kv"

export const guardConfig = {
  store: process.env.NODE_ENV === 'production'
    ? createUpstashStore(kv)
    : createMemoryStore(),

  cfApiToken: process.env.CF_API_TOKEN,
  cfZoneId: process.env.CF_ZONE_ID,
};

3. Middleware (middleware.ts)

import { createMiddleware } from "coonlink-manyersuchapita"
import { guardConfig } from "./lib/guard"

export const { middleware, config } = createMiddleware(guardConfig);

4. 404 page (app/not-found.tsx)

import { track404 } from "coonlink-manyersuchapita"
import { guardConfig } from "@/lib/guard"

export default async function NotFound() {
  await track404(guardConfig);
  return <div>Not found</div>;
}

CF IP Verification (optional)

Client-side script checks if the browser can reach Cloudflare's IP endpoint. If blocked (VPN / extension hiding real IP) → redirect to YouTube.

1. Environment variables

CF_IP_CHECK=1
CF_IP_CHECK_URL=https://ip-check-perf.radar.cloudflare.com
NEXT_PUBLIC_CF_IP_CHECK_URL=https://ip-check-perf.radar.cloudflare.com

2. Enable in config (lib/guard.ts)

export const guardConfig = {
  cfIpCheck: (Number(process.env.CF_IP_CHECK) || 0) as 0 | 1,
  cfIpCheckUrl: process.env.CF_IP_CHECK_URL,
};

3. Verify endpoint (app/api/_guard/verify/route.ts)

import { createVerifyHandler } from "coonlink-manyersuchapita"
import { guardConfig } from "@/lib/guard"

export const POST = createVerifyHandler(guardConfig);
export const runtime = 'edge';

4. Client script (app/layout.tsx)

import { IpCheckScript } from "coonlink-manyersuchapita/client"

export default function Layout({ children }) {
  return (
    <html>
      <body>
        {children}
        {process.env.NEXT_PUBLIC_CF_IP_CHECK_URL && (
          <IpCheckScript cfIpCheckUrl={process.env.NEXT_PUBLIC_CF_IP_CHECK_URL} />
        )}
      </body>
    </html>
  );
}

How it works

  1. Page loads → IpCheckScript calls CF_IP_CHECK_URL in the browser
  2. Success → real IP posted to /api/_guard/verify → stored in KV (1h TTL)
  3. Blocked → posts blocked: true → next request redirects to YouTube
  4. Session cookie _gsid (httpOnly) ties browser to KV record