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

ratelite

v1.0.3

Published

A simple, modern, and flexible Redis-based rate limiter for Express.js — built for real-world APIs, SaaS, and edge-compatible environments.

Readme

Ratelite

A simple, modern, and flexible Redis-based rate limiter for Express.js, designed for serverless functions, edge environments, and traditional Node.js applications.

NPM version NPM downloads

Features

  • Simple API: Get started in minutes with a clean and intuitive API.
  • Upstash Redis: Built on @upstash/redis for serverless and edge compatibility.
  • Flexible: Customize keys, error messages, and behavior with ease.
  • TypeScript Ready: Fully written in TypeScript with type definitions included.

Installation

npm install ratelite express

Quick Start

Create a new Upstash Redis database at upstash.com and get your UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

import express from "express";
import { createRateLimiter } from "ratelite";

const app = express();

// Create a rate limiter that allows 10 requests per minute from an IP address.
const rateLimiter = createRateLimiter({
	redisUrl: process.env.UPSTASH_REDIS_REST_URL!,
	redisToken: process.env.UPSTASH_REDIS_REST_TOKEN!,
	maxRequests: 10,
	windowInSeconds: 60,
});

app.use(rateLimiter);

app.get("/", (req, res) => {
	res.send("Hello, World!");
});

app.listen(3000, () => {
	console.log("Server is running on port 3000");
});

Configuration

The createRateLimiter function accepts the following options:

| Option | Type | Required | Description | | ----------------- | ----------------------------------------------------- | -------- | ---------------------------------------------------------------------------- | | redisUrl | string | Yes | Your Upstash Redis REST URL. | | redisToken | string | Yes | Your Upstash Redis REST token. | | maxRequests | number | Yes | The maximum number of requests to allow per window. | | windowInSeconds | number | Yes | The duration of the time window in seconds. | | keyFn | (req: Request) => string | No | A function to generate a unique key for rate limiting. Defaults to req.ip. | | onLimitReached | (req: Request, res: Response) => void | No | A callback to execute when the rate limit is exceeded. | | onError | (err: unknown, req: Request, res: Response) => void | No | A callback to handle errors from the Redis client. | | debug | boolean | No | Set to true to log debug information. |

Custom Key Generation

By default, the ratelite uses the client's IP address (req.ip). You can provide a custom keyFn to use a different identifier, such as an API key or user ID.

const rateLimiter = createRateLimiter({
	// ... other options
	keyFn: (req) => req.headers["x-api-key"] as string,
});

Testing

To run the test suite:

npm test

License

This project is licensed under the MIT License. See the LICENSE file for details.