Skip to content
zedkit
@zedtech/zedkit-server

Rate-limit calls per key

In-process per-key rate limiting with a two-line check.

At a glance

  • Who: Node developers protecting endpoints from abuse without infrastructure.
  • What: In-process per-key rate limiting with a two-line check.
  • Use when: For single-instance services and per-IP/per-user throttling.
  • Avoid when: Across multiple instances — use a shared-store (Redis) limiter instead.

Install

pnpm add @zedtech/zedkit-server

Latest: 1.3.1 (via changesets).

Example

Usage
import { MemoryRateLimiter } from "@zedtech/zedkit-server";
const limiter = new MemoryRateLimiter();
if (!limiter.allow(clientIp, 100)) return tooManyRequests();

// Optional: another window, a test clock, a different sweep threshold.
const perTenSeconds = new MemoryRateLimiter({ windowMs: 10_000, now: () => clock.now(), maxKeys: 5_000 });

Wraps: (none)

On this page