# rt-limit

> A simple IP address based rate limiting module written in Typescript with zero dependencies.

Latest version **1.0.1** (published 2022-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install rt-limit
pnpm add rt-limit
yarn add rt-limit
bun add rt-limit
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-01-13 |
| First published | 2022-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Cyrus Kao |
| Maintainers | cyruskao |
| Keywords | ratelimit, ip, Typescript |

## Links

- npm: https://www.npmjs.com/package/rt-limit
- Repository: https://github.com/CyrusKao/rt-limit
- Homepage: https://github.com/CyrusKao/rt-limit#readme
- Issues: https://github.com/CyrusKao/rt-limit/issues
- npm.io page: https://npm.io/package/rt-limit

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-01-13
- 1.0.0 — 2022-01-13

## README

# RT Limit

A simple IP address based rate limiting module written in Typescript with zero dependencies.

> See how it's implemented at [my blog post](https://nocache.org/p/build-a-ip-based-rate-limiting-module-in-node-js-with-typescript).

## Installation

```sh
npm i rt-limit
```

## Usage

```ts
import Ratelimit from 'rt-limit';
import express from 'express';

const ratelimit = new Ratelimit(60, 60 * 1000);
const app = express();

app.use((req, res, next) => {
  if (ratelimit.consume(req.ip, 1)) {
    next();
    return;
  }

  res.status(429).end();
});
```

---
_Source: https://npm.io/package/rt-limit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
