Registry / web-framework / limiting-middleware

limiting-middleware

JSON →
library1.3.2jsnpmunverified

The package `limiting-middleware` provides a simple, IP-based rate limiting solution for Express applications, restricting client requests within a defined time frame. Currently at version 1.3.2, the module has not received updates since 2019, making it an abandoned project. Its initial development was for personal use, which explains its limited feature set compared to more actively maintained and mature alternatives like `express-rate-limit`. Key limitations include exclusive reliance on CommonJS `require()` syntax, absence of ESM support, and a basic in-memory store, rendering it unsuitable for production environments requiring scalability, advanced configurations, or robust security updates.

npm install limiting-middleware
INSTALL
IMPORT
SIG · LIMITING-MIDDLEWAR
L
limiting-middleware
web-frameworkjavascriptv1.3.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LimitingMiddleware
const LimitingMiddleware = require('limiting-middleware');
import LimitingMiddleware from 'limiting-middleware';
This package exclusively uses CommonJS 'require()' syntax; ES module imports are not supported.

Demonstrates how to initialize and apply the IP-based rate limiting middleware to an Express application.

const express = require('express'); const LimitingMiddleware = require('limiting-middleware'); const app = express(); const PORT = process.env.PORT ?? 3000; // Apply the rate limiting middleware globally. // Limits each IP to 10 requests every 5 minutes (300,000 ms). app.use(new LimitingMiddleware({ limit: 10, resetInterval: 300000 }).limitByIp()); app.get('/', (req, res) => { res.send('Hello! This route is rate-limited.'); }); app.get('/unlimited', (req, res) => { res.send('This route is not explicitly rate-limited by the middleware.'); }); app.listen(PORT, () => { console.log(`Server listening on port ${PORT}`); console.log('Try hitting / multiple times to see the rate limit in action.'); });
Debug
Known issues
breakingThis package has not been updated since 2019 and is considered abandoned. It does not receive security patches, bug fixes, or new features.
fix
Migrate to actively maintained alternatives such as `express-rate-limit` (for blocking) or `express-slow-down` (for throttling).
affects: >=1.0.0
gotchaThe package only supports CommonJS (`require()`) syntax. Attempting to import it using ES Modules (`import`) will result in a runtime error.
fix
Ensure your project uses CommonJS or continue to use `const LimitingMiddleware = require('limiting-middleware');` even in an ESM project if your build setup supports CJS interoperability (though generally not recommended for new projects).
affects: >=1.0.0
gotchaThe built-in rate limit store is in-memory only. This means rate limits are not synchronized across multiple application instances or processes, leading to inaccurate limiting in clustered environments or when using process managers like PM2.
fix
For production deployments with multiple instances, use a rate limiting solution that supports external stores (e.g., Redis) for shared state, such as `express-rate-limit` with a Redis store.
affects: >=1.0.0
gotchaThe configuration options are limited to `limit` and `resetInterval`. More advanced features like custom key generation, whitelisting, different rate limiting algorithms (e.g., sliding window), or custom error responses are not directly supported.
fix
Evaluate if more feature-rich alternatives like `express-rate-limit` or `express-slow-down` provide the necessary advanced configurations for your use case.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'limitByIp')
The `LimitingMiddleware` class was called without the `new` keyword, meaning `limitByIp()` was invoked on the class itself rather than an instantiated object.
fix
Instantiate the middleware with `new LimitingMiddleware({...})` before calling `.limitByIp()`. Correct usage: `app.use(new LimitingMiddleware({ limit: 100, resetInterval: 1200000 }).limitByIp());`
ERR_REQUIRE_ESM
Attempted to use ES module `import` syntax to load a CommonJS-only package. This package does not provide an ESM entry point.
fix
Use CommonJS `require()` syntax instead: `const LimitingMiddleware = require('limiting-middleware');`
Rate limit not working consistently across multiple server instances.
The package uses an in-memory store for rate limiting, which is isolated to each Node.js process. In a multi-instance deployment (e.g., load-balanced servers, PM2 clusters), each instance maintains its own separate rate limits.
fix
This package is not designed for distributed rate limiting. Consider migrating to `express-rate-limit`, which supports various external stores like Redis to synchronize rate limits across multiple instances.
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
limiting-middleware — npm install limiting-middleware · libregistry