{"id":13630573,"url":"https://github.com/microlinkhq/async-ratelimiter","last_synced_at":"2026-03-18T00:08:08.365Z","repository":{"id":32592952,"uuid":"137690849","full_name":"microlinkhq/async-ratelimiter","owner":"microlinkhq","description":"Rate limit made simple, easy, async.","archived":false,"fork":false,"pushed_at":"2025-11-14T19:01:14.000Z","size":170,"stargazers_count":335,"open_issues_count":0,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-14T21:05:07.327Z","etag":null,"topics":["nodejs","rate-limiting"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microlinkhq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-06-17T22:21:29.000Z","updated_at":"2025-11-14T19:01:16.000Z","dependencies_parsed_at":"2024-06-18T13:54:50.816Z","dependency_job_id":"180ca8e0-212b-4fcf-b191-94a50c6948a4","html_url":"https://github.com/microlinkhq/async-ratelimiter","commit_stats":{"total_commits":107,"total_committers":14,"mean_commits":7.642857142857143,"dds":"0.28037383177570097","last_synced_commit":"caed0a994e422667cbb302d62d6a17564742f441"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/microlinkhq/async-ratelimiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fasync-ratelimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fasync-ratelimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fasync-ratelimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fasync-ratelimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microlinkhq","download_url":"https://codeload.github.com/microlinkhq/async-ratelimiter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microlinkhq%2Fasync-ratelimiter/sbom","scorecard":{"id":642922,"data":{"date":"2025-08-11","repo":{"name":"github.com/microlinkhq/async-ratelimiter","commit":"b525746e58054c9189ac324b9116c2a3ef3055b7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Warn: no topLevel permission defined: .github/workflows/pull_request.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":8,"reason":"10 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 8","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/26 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":0,"reason":"dangerous workflow patterns detected","details":["Warn: script injection with untrusted input ' github.head_ref ': .github/workflows/main.yml:30"],"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/pull_request.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/pull_request.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pull_request.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/pull_request.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/pull_request.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull_request.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/microlinkhq/async-ratelimiter/pull_request.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T11:18:55.832Z","repository_id":32592952,"created_at":"2025-08-21T11:18:55.833Z","updated_at":"2025-08-21T11:18:55.833Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30636835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T23:56:54.546Z","status":"ssl_error","status_checked_at":"2026-03-17T23:56:28.952Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","rate-limiting"],"created_at":"2024-08-01T22:01:47.667Z","updated_at":"2026-03-18T00:08:08.353Z","avatar_url":"https://github.com/microlinkhq.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries"],"sub_categories":["Services"],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner.png#gh-light-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cimg src=\"https://github.com/microlinkhq/cdn/raw/master/dist/logo/banner-dark.png#gh-dark-mode-only\" alt=\"microlink logo\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/div\u003e\n\n![Last version](https://img.shields.io/github/tag/microlinkhq/async-ratelimiter.svg?style=flat-square)\n[![Coverage Status](https://img.shields.io/coveralls/microlinkhq/async-ratelimiter.svg?style=flat-square)](https://coveralls.io/github/microlinkhq/async-ratelimiter)\n[![NPM Status](https://img.shields.io/npm/dm/async-ratelimiter.svg?style=flat-square)](https://www.npmjs.org/package/async-ratelimiter)\n\n\u003e Rate limit made simple, easy, async. Based on [ratelimiter](https://github.com/tj/node-ratelimiter).\n\n## Install\n\n```bash\n$ npm install async-ratelimiter --save\n```\n\n## Usage\n\nThe most straightforward way to use the rate limiter:\n\n```js\n'use strict'\n\nconst RateLimiter = require('async-ratelimiter')\nconst { getClientIp } = require('request-ip')\nconst Redis = require('ioredis')\n\nconst rateLimiter = new RateLimiter({\n  db: new Redis()\n})\n\nconst apiQuota = async (req, res, next) =\u003e {\n  const clientIp = getClientIp(req)\n  const limit = await rateLimiter.get({ id: clientIp })\n\n  if (!res.writableEnded) {\n    res.setHeader('X-Rate-Limit-Limit', limit.total)\n    res.setHeader('X-Rate-Limit-Remaining', Math.max(0, limit.remaining - 1))\n    res.setHeader('X-Rate-Limit-Reset', limit.reset)\n  }\n\n  return !limit.remaining\n    ? sendFail({\n        req,\n        res,\n        code: HTTPStatus.TOO_MANY_REQUESTS,\n        message: MESSAGES.RATE_LIMIT_EXCEDEED()\n      })\n    : next(req, res)\n}\n```\nFor scenarios where you want to check the limit status before consuming a request, you should to pass `{ peek: true }`:\n\n```js\nconst apiQuota = async (req, res, next) =\u003e {\n  const clientIp = getClientIp(req)\n\n  // Check rate limit status without consuming a request\n  const status = await rateLimiter.get({ id: clientIp, peek: true })\n\n  if (status.remaining === 0) {\n    return sendFail({\n      req,\n      res,\n      code: HTTPStatus.TOO_MANY_REQUESTS,\n      message: MESSAGES.RATE_LIMIT_EXCEDEED()\n    })\n  }\n\n  // Consume a request\n  const limit = await rateLimiter.get({ id: clientIp })\n\n  if (!res.writableEnded) {\n    res.setHeader('X-Rate-Limit-Limit', limit.total)\n    res.setHeader('X-Rate-Limit-Remaining', limit.remaining)\n    res.setHeader('X-Rate-Limit-Reset', limit.reset)\n  }\n\n  return next(req, res)\n}\n```\n\n\n\n## API\n\n### constructor(options)\n\nIt creates an rate limiter instance.\n\n#### options\n\n##### db\n\n_Required_\u003cbr\u003e\nType: `object`\n\nThe redis connection instance.\n\n##### max\n\nType: `number`\u003cbr\u003e\nDefault: `2500`\n\nThe maximum number of requests within `duration`.\n\n##### duration\n\nType: `number`\u003cbr\u003e\nDefault: `3600000`\n\nHow long keep records of requests in milliseconds.\n\n##### namespace\n\nType: `string`\u003cbr\u003e\nDefault: `'limit'`\n\nThe prefix used for compound the key.\n\n##### id\n\nType: `string`\n\nThe identifier to limit against (typically a user id).\n\nYou can pass this value using when you use `.get` method as well.\n\n### .get(options)\n\nGiven an `id`, returns a Promise with the status of the limit with the following structure:\n\n- `total`: `max` value.\n- `remaining`: number of calls left in current `duration` without decreasing current `get`.\n- `reset`: time since epoch in seconds that the rate limiting period will end (or already ended).\n\n#### options\n\n##### id\n\nType: `string`\nDefault: `this.id`\n\nThe identifier to limit against (typically a user id).\n\n##### max\n\nType: `number`\u003c/br\u003e\nDefault: `this.max`\n\nThe maximum number of requests within `duration`. If provided, it overrides the default `max` value. This is useful for custom limits that differ between IDs.\n\n##### duration\n\nType: `number`\u003c/br\u003e\nDefault: `this.duration`\n\nHow long keep records of requests in milliseconds. If provided, it overrides the default `duration` value.\n\n##### peek\n\nType: `boolean`\u003cbr\u003e\nDefault: `false`\n\nWhen set to `true`, returns the current rate limit status **without consuming a request**. This is useful for checking the current rate limit status before deciding whether to proceed with an operation.\n\n### defineCommand\n\nIt provides the command definition so you can load it into any [ioredis](https://github.com/redis/ioredis) instance:\n\n```js\nconst Redis = require('ioredis')\nconst redis = new Redis(uri, {\n  scripts: { ...require('async-ratelimiter').defineCommand }\n})\n```\n\n## Related\n\n- [express-slow-down](https://github.com/nfriedly/express-slow-down) – Slow down repeated requests; use as an alternative (or addition) to express-rate-limit.\n\n## License\n\n**async-ratelimiter** © [microlink.io](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/async-ratelimiter/blob/master/LICENSE.md) License.\u003cbr\u003e\nAuthored and maintained by [Kiko Beats](https://kikobeats.com) with help from [contributors](https://github.com/microlinkhq/async-ratelimiter/contributors).\n\n\u003e [microlink.io](https://microlink.io) · GitHub [microlink.io](https://github.com/microlinkhq) · X [@microlinkhq](https://x.com/microlinkhq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fasync-ratelimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrolinkhq%2Fasync-ratelimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrolinkhq%2Fasync-ratelimiter/lists"}