{"id":17923,"library":"reqlim","title":"reqlim: Request Limiting Middleware","description":"reqlim is a Connect/Express middleware designed to limit incoming requests, acting as a direct adaptation of the popular `express-rate-limit` package. Its primary function is to prevent abuse by restricting the number of requests a user can make within a specified timeframe, returning a 429 'Too Many Requests' status when limits are exceeded. Despite its utility, the package remains at an early development stage with version 0.0.0 and has not seen active development since its initial publication over four years ago. This makes it an effectively abandoned project. Developers seeking a stable, actively maintained, and feature-rich rate-limiting solution for Express applications should opt for `express-rate-limit` directly, which served as the inspiration for `reqlim` and offers continuous updates, bug fixes, and better community support, including TypeScript definitions.","status":"abandoned","version":"0.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/jsless/reqlim","tags":["javascript"],"install":[{"cmd":"npm install reqlim","lang":"bash","label":"npm"},{"cmd":"yarn add reqlim","lang":"bash","label":"yarn"},{"cmd":"pnpm add reqlim","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"reqlim is a CommonJS-only package. Direct ESM `import` statements will fail without a CJS interop layer or transpilation.","wrong":"import rateLimit from 'reqlim'","symbol":"rateLimit","correct":"const rateLimit = require('reqlim')"},{"note":"The `rateLimit` function must be called to create and return the actual middleware instance, even if no options are passed. Passing options configures its behavior.","wrong":"app.use(rateLimit)","symbol":"middleware factory","correct":"app.use(rateLimit({ windowMs: 60 * 1000, max: 5 }))"},{"note":"Configuration for the rate limiter is done exclusively through a single options object, not via positional arguments.","wrong":"rateLimit(60000, 100)","symbol":"options configuration","correct":"rateLimit({ windowMs: 60000, max: 100, statusCode: 429 })"}],"quickstart":{"code":"const express = require('express');\nconst rateLimit = require('reqlim');\n\nconst app = express();\nconst port = 3000;\n\n// Basic rate limiting middleware: 5 requests per minute per IP\nconst limiter = rateLimit({\n  windowMs: 60 * 1000, // 1 minute\n  max: 5, // Limit each IP to 5 requests per `window`\n  message: 'Too many requests from this IP, please try again after a minute',\n  headers: true, // Send rate limit info in headers\n  onLimitReached: (req, res, options) => {\n    console.log(`IP ${req.ip} has reached the limit on ${req.url}`);\n  }\n});\n\n// Apply the rate limiting middleware to all requests\napp.use(limiter);\n\n// Define a simple route\napp.get('/', (req, res) => {\n  res.send('Hello World! You are being rate limited.');\n});\n\n// Start the server\napp.listen(port, () => {\n  console.log(`Server listening at http://localhost:${port}`);\n  console.log('Try to make more than 5 requests in a minute to see the rate limit in action.');\n});","lang":"javascript","description":"This quickstart demonstrates how to set up `reqlim` as a global middleware for an Express application, limiting requests to 5 per minute per IP address. It includes basic configuration, a custom message, and an `onLimitReached` callback for logging."},"warnings":[{"fix":"Migrate to `express-rate-limit` which is actively maintained, feature-rich, and the upstream project `reqlim` was based on.","message":"The package version is 0.0.0, indicating it is an unstable, pre-release version. It has not been updated in over four years, meaning it is effectively abandoned and should not be used in production environments.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use `const rateLimit = require('reqlim')` for Node.js CommonJS projects, or consider using `express-rate-limit` which often provides better ESM support or type definitions.","message":"reqlim is a CommonJS-only package. Attempting to use `import` syntax in an ESM project will result in runtime errors unless a build step or Node.js's CJS interop is properly configured.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install `@types/reqlim` if available (unlikely for an abandoned package) or create a custom `d.ts` declaration file. The recommended fix is to use `express-rate-limit` which has official TypeScript support.","message":"The package does not ship with TypeScript type definitions. Using it in a TypeScript project will require manually declaring types or suppressing type errors, which can lead to runtime issues.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace `reqlim` with a well-maintained and secure alternative like `express-rate-limit` to ensure ongoing security and stability.","message":"Due to its abandoned status, `reqlim` will not receive security updates, bug fixes, or performance improvements. Using it could expose applications to known vulnerabilities or introduce unexpected behavior.","severity":"breaking","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure your project is configured for CommonJS, or use `import` syntax with a CJS interop (e.g., `import rateLimit from 'reqlim';`). The simplest solution is to use a modern, ESM-compatible rate limiter like `express-rate-limit`.","cause":"Attempting to use `require()` in a Node.js ES Module (`.mjs` file or `type: 'module'` in `package.json`) without proper transpilation.","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"Always invoke the `rateLimit` function to get the actual middleware: `app.use(rateLimit({ ...options }))`.","cause":"Calling `app.use(rateLimit)` instead of `app.use(rateLimit())`. The `rateLimit` export is a factory function that *returns* the middleware.","error":"TypeError: app.use() requires a middleware function but got a undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}