Skip to content

OPEN SOURCE · TYPESCRIPT

throttlekit

An open-source TypeScript rate-limiting library implementing fixed window, sliding window log and token bucket behind a single API surface.

See on GitHub
  • TypeScript
  • Jest
  • GitHub Actions

01Why three algorithms

Fixed window is cheap and fine until traffic clusters at a boundary and you serve double your limit in a two-second span. Sliding window log fixes that and costs memory. Token bucket handles bursts gracefully and is the wrong mental model for a hard quota.

They are different trade-offs rather than better and worse, so the library ships all three behind one interface and lets the caller choose.

02The tests are the point

A Jest suite built around the cases that actually bite in production: boundary conditions at window edges, clock skew, and concurrent consumption of the same bucket. GitHub Actions runs it on every push.

03Built with

  • TypeScript
  • Jest
  • GitHub Actions

// KEEP LOOKING

More work