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

edgeshield

v0.3.0

Published

Edge-native security toolkit with rate limiting, bot detection, and pluggable storage.

Readme

EdgeShield

EdgeShield logo

npm version CI Coverage License: MIT TypeScript

Edge-native security toolkit for modern TypeScript runtimes.

Current release scope: v0.3.0 includes rate limiting + bot detection + CSRF protection.

Install

npm install edgeshield

Quick Start

import { rateLimit, slidingWindow } from "edgeshield/ratelimit";
import { memory } from "edgeshield/storage/memory";

const limiter = rateLimit({
  storage: memory(),
  algorithm: slidingWindow(100, "15m")
});

const result = await limiter.check(request);
if (!result.success) {
  return new Response("Too Many Requests", { status: 429, headers: result.headers });
}

Bot Guard (v0.2.0)

import { botGuard } from "edgeshield/bot";

const guard = botGuard({
  mode: "block",
  threshold: 60,
  rules: {
    allow: [/googlebot/i, /bingbot/i],
    block: [/curl/i, /python-requests/i, /scrapy/i]
  }
});

const bot = await guard.check(request);
if (!bot.success) {
  return new Response("Forbidden", { status: 403, headers: bot.headers });
}

Sloth VDF Challenge

import { botGuard, VDF } from "edgeshield/bot";

const guard = botGuard({
  mode: "block",
  threshold: 40,
  vdf: { enabled: true, steps: 20, maxAgeMs: 300000 }
});

const first = await guard.check(request);
if (first.reason === "vdf_challenge_required") {
  const challenge = first.headers.get("x-edgeshield-vdf-challenge");
  const steps = Number(first.headers.get("x-edgeshield-vdf-steps"));
  const challengeHex = challenge?.split(".")[0] ?? "";
  const proof = await VDF.compute(challengeHex, steps);
  // Send challenge + proof headers in the next request:
  // x-edgeshield-vdf-challenge: <challenge>
  // x-edgeshield-vdf-solution: <proof>
}

Cloudflare KV Adapter

import { cloudflareKV } from "edgeshield/storage/cloudflare-kv";
import { rateLimit, slidingWindow } from "edgeshield/ratelimit";

const storage = cloudflareKV({ binding: env.EDGE_KV, prefix: "edgeshield" });
const limiter = rateLimit({
  storage,
  algorithm: slidingWindow(100, "15m")
});

CSRF Guard (v0.3.0)

import { csrfGuard } from "edgeshield/csrf";

const csrf = csrfGuard({
  mode: "double-submit",
  secret: process.env.CSRF_SECRET!,
  ttl: "1h",
  ignorePaths: ["/api/webhooks/**"]
});

const token = await csrf.generate(request);
const cookie = csrf.buildCookie(token);

const verify = await csrf.verify(request);
if (!verify.valid) {
  return new Response("Forbidden", { status: 403 });
}

Vercel KV Adapter

import { vercelKV } from "edgeshield/storage/vercel-kv";

const storage = vercelKV({
  client: kv,
  prefix: "edgeshield"
});

Hono Middleware

import { Hono } from "hono";
import { edgeshield } from "edgeshield/middleware/hono";
import { rateLimit, slidingWindow } from "edgeshield/ratelimit";
import { botGuard } from "edgeshield/bot";

const app = new Hono();

app.use(
  "/api/*",
  edgeshield(
    rateLimit({ storage, algorithm: slidingWindow(100, "15m") }),
    botGuard({ mode: "block", threshold: 60 })
  )
);

Features in v0.3.0

  • Sliding and fixed window algorithms
  • Multi-tier rate limiting
  • Bot detection (detect and block modes)
  • Sloth VDF challenge support for suspicious bot traffic
  • CSRF protection (double-submit and origin-check)
  • Memory, Upstash, Cloudflare KV, and Vercel KV adapters
  • Next.js and Hono middleware helpers
  • TypeScript-first API

Comparison

Note: the table reflects the full product vision across roadmap versions.

| Feature | edgeshield | @upstash/ratelimit | rate-limiter-flexible | express-rate-limit | |---|---|---|---|---| | Edge-native (no Node APIs) | Yes | Yes | No | No | | Storage-agnostic | Yes | Upstash only | Redis/Mongo/Postgres | Memory/Redis | | Rate limiting | Yes (v0.1.0) | Yes | Yes | Yes | | Bot detection | Yes (v0.2.0) | No | No | No | | CSRF protection | Yes (v0.3.0) | No | No | No | | Tree-shakeable subpaths | Yes | No | No | No | | Zero dependencies | Yes | Needs @upstash/redis | 0 deps (core) | 0 deps | | Bundle size target | < 4 KB (core ratelimit subpath) | ~8 KB | ~15 KB | ~5 KB |

Roadmap

  • v0.1.0 — Core rate limiting + memory + upstash adapters + Next.js middleware
  • v0.2.0 — Bot detection module + Cloudflare KV adapter
  • v0.3.0 — CSRF module + Hono middleware + Vercel KV adapter
  • v0.4.0 — Presets, Deno KV adapter, analytics hooks
  • v1.0.0 — Stable API, full docs site, all adapters battle-tested

Build And Test

npm run build
npm run test:coverage
npm run security:audit

Publish

npm run prepublishOnly
npm publish --access public

Recommended release flow:

npm run lint
npm run typecheck
npm run test:coverage
npm run build
npm pack --dry-run