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

@proudmars/busy-highway

v1.0.5

Published

A simple and efficient rate limiting library for Node.js.

Downloads

58

Readme

Busy Highway

A simple and efficient rate limiting library for Node.js that implements various rate limiting algorithms.

Installation

npm install @proudmars/busy-highway

Features

  • Multiple rate limiting algorithms:
    • Token Bucket
    • Leaky Bucket
    • Fixed Window Counter
    • Sliding Window Counter
    • Sliding Window Log

Usage

import { 
  TokenBucket,
  LeakyBucket,
  FixedWindowCounter,
  SlidingWindowCounter,
  SlidingWindowLog
} from '@proudmars/busy-highway';

// Token Bucket Example
const tokenBucket = new TokenBucket(10, 2); // 10 tokens, refills 2 tokens/second
if (tokenBucket.allowRequest()) {
  // Process request
}

// Leaky Bucket Example
const leakyBucket = new LeakyBucket(5, 1); // 5 requests capacity, leaks 1 request/second
if (leakyBucket.allowRequest()) {
  // Process request
}

// Fixed Window Example
const fixedWindow = new FixedWindowCounter(100, 60); // 100 requests per 60 seconds
if (fixedWindow.allowRequest()) {
  // Process request
}

// Sliding Window Counter Example
const slidingWindow = new SlidingWindowCounter(100, 60); // 100 requests per 60 seconds
if (slidingWindow.allowRequest()) {
  // Process request
}

// Sliding Window Log Example
const slidingLog = new SlidingWindowLog(100, 60); // 100 requests per 60 seconds
if (slidingLog.allowRequest()) {
  // Process request
}

Algorithm Details

Token Bucket

  • Maintains a bucket of tokens that refills at a fixed rate
  • Each request consumes one token
  • Good for handling bursts while maintaining average rate

Leaky Bucket

  • Requests enter a fixed-capacity bucket
  • Requests leak out at a constant rate
  • Good for smoothing out traffic spikes

Fixed Window Counter

  • Counts requests in fixed time windows
  • Resets counter at window boundaries
  • Simple but can allow twice the rate at window boundaries

Sliding Window Counter

  • Uses weighted sliding window approach
  • Smooths out boundary conditions of fixed windows
  • Good balance of accuracy and memory usage

Sliding Window Log

  • Keeps track of timestamp of each request
  • Most accurate but higher memory usage
  • Good for precise rate limiting

Development

# Install dependencies
pnpm install

# Build the project
pnpm build

# Run linting
pnpm lint

# Run in development mode with watch
pnpm dev

License

MIT © ProudMars