{"id":16775007,"url":"https://github.com/masasron/adonis-throttle","last_synced_at":"2025-10-30T19:39:28.499Z","repository":{"id":51481452,"uuid":"80429764","full_name":"masasron/adonis-throttle","owner":"masasron","description":"A rate limiter for Adonis JS","archived":false,"fork":false,"pushed_at":"2022-12-30T17:15:49.000Z","size":135,"stargazers_count":63,"open_issues_count":11,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-06T23:57:07.461Z","etag":null,"topics":["adonis-throttle","adonisjs","rate-limits"],"latest_commit_sha":null,"homepage":null,"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/masasron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-30T14:43:05.000Z","updated_at":"2024-11-16T12:41:24.000Z","dependencies_parsed_at":"2023-01-31T12:15:58.890Z","dependency_job_id":null,"html_url":"https://github.com/masasron/adonis-throttle","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/masasron/adonis-throttle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fadonis-throttle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fadonis-throttle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fadonis-throttle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fadonis-throttle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masasron","download_url":"https://codeload.github.com/masasron/adonis-throttle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masasron%2Fadonis-throttle/sbom","scorecard":{"id":622650,"data":{"date":"2025-08-11","repo":{"name":"github.com/masasron/adonis-throttle","commit":"7c6df466598513da8d2b4d4a63152411b3707315"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Code-Review","score":2,"reason":"Found 5/20 approved changesets -- score normalized to 2","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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:0","Info: FSF or OSI recognized license: MIT License: LICENSE: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 15 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"}},{"name":"Vulnerabilities","score":0,"reason":"44 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-4x6g-3cmx-w76r","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-pp7h-53gx-mx7r","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-9j49-mfvp-vmhm","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-jg8v-48h5-wgxg","Warn: Project is vulnerable to: GHSA-36fh-84j7-cv5h","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-6xwr-q98w-rvg7","Warn: Project is vulnerable to: GHSA-4c7m-wxvm-r7gc","Warn: Project is vulnerable to: GHSA-pch5-whg9-qr2r","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-hpqj-7cj6-hfj8","Warn: Project is vulnerable to: GHSA-4vrv-93c7-m92j","Warn: Project is vulnerable to: GHSA-6hwc-9h8r-3vmf","Warn: Project is vulnerable to: GHSA-qqqw-gm93-qf6m","Warn: Project is vulnerable to: GHSA-69f9-h8f9-7vjf","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T05:31:42.055Z","repository_id":51481452,"created_at":"2025-08-21T05:31:42.055Z","updated_at":"2025-08-21T05:31:42.055Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281870575,"owners_count":26576245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["adonis-throttle","adonisjs","rate-limits"],"created_at":"2024-10-13T06:50:44.100Z","updated_at":"2025-10-30T19:39:28.467Z","avatar_url":"https://github.com/masasron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adonis Throttle\n\nA rate limiter for Adonis 4.1\n\n[![npm version](https://badge.fury.io/js/adonis-throttle.svg)](https://badge.fury.io/js/adonis-throttle)\n[![npm](https://img.shields.io/npm/dt/adonis-throttle.svg)](https://www.npmjs.com/package/adonis-throttle)\n[![CircleCI](https://img.shields.io/circleci/project/github/masasron/adonis-throttle.svg)](https://circleci.com/gh/masasron/adonis-throttle)\n[![Known Vulnerabilities](https://snyk.io/test/github/masasron/adonis-throttle/badge.svg?targetFile=package.json)](https://snyk.io/test/github/masasron/adonis-throttle?targetFile=package.json)\n\n## Installation\n\n\u003e For AdonisJS below version 4.1, you need install 2.0.x\n\nTo get the latest version of Adonis Throttle, simply run:\n\n```console\nadonis install adonis-throttle\n```\n\nOnce Adonis Throttle is installed, you need to register the service provider.\nOpen up bootstrap/app.js and add the following to the providers key.\n\n```js\n// start/app.js\nconst providers = [\n  ...,\n  'adonis-throttle/providers/ThrottleProvider',\n]\n```\n\nYou can register the Throttle facade in the aliases key of your bootstrap/app.js file if you like.\n\n```js\n// start/app.js\nconst aliases = {\n  ...,\n  Throttle: 'Adonis/Addons/Throttle'\n}\n```\n\nEnable the throttle middleware inside `start/kernel.js` file.\n\n```js\n// start/kernel.js\n\nconst namedMiddleware = {\n  ...,\n  throttle: 'Adonis/Middleware/Throttle'\n}\n```\n\n## Usage\n\n### Middleware\n\nUse the throttle middleware to limit request for a given route.\n\n```js\n// Default Throttle 60 request per minute\nRoute.post('login','Auth/LoginController.postLogin').middleware('throttle')\n```\n\nThe following example throttle request be limiting the number of login attempts for 10 requests every 120 seconds.\n\n```js\nRoute.post('login','Auth/LoginController.postLogin').middleware('throttle:10,120')\n```\n\nThrottle 10 request per minute\n\n```js\nRoute.post('login','Auth/LoginController.postLogin').middleware('throttle:10')\n```\n\nIf the subject exceeds the maximum number of requests, it will return Too Many Attempts. with status code of 429.\nBy default we are extending the decay of the throttle by 5 seconds, for each request the subject after he exceeds the maximum number of requests.\n\n### Advanced usage\n\nYou can also use Throttle from inside your controllers or anywere else.\n\n```js\n\nconst Throttle = use('Throttle')\n\nclass TestController {\n\n  run(request,response){\n    const currentUser = request.auth.getCurrentUser()\n    // Limit for a specific user\n    Throttle.resource(currentUser.id,10,60)\n    if (!Throttle.attempt()){\n      return response.send('stop!')\n    }\n    response.send('secret')\n  }\n\n}\n```\n\n## Extending cache driver\n\nYou can write your own cache driver by extending `Adonis/Addons/Throttle/Cache`\nabstract base class.\n\nFor the purpose of this example, assume the contents of the file below are\nlocated at: `./lib/drivers/memcached`.\n\n```js\n'use strict'\n\nconst Cache = use('Adonis/Addons/Throttle/Cache')\n\nclass Memcached extends Cache {\n    /**\n   * Get stored data by key.\n   * @param {String} key\n   *\n   * @return {Mixed}\n   */\n  get(key) {\n    // implement get\n  }\n\n  /**\n   * Generate cache.\n   * @param {String} key\n   * @param {Mixed} value\n   * @param {Integer} milliseconds\n   *\n   * @return {TimeoutPointer}\n   */\n  put(key, value, milliseconds) {\n    // implement put\n  }\n\n  /**\n   * Increment stored value by one.\n   * @param {String} key\n   *\n   * @return {Cache}\n   */\n  increment(key) {\n    // implement increment\n    return this\n  }\n\n  /**\n   * Increment expiration of stored data by number of seconds.\n   * @param {String} key\n   * @param {Integer} seconds\n   *\n   * @return {Cache}\n   */\n  incrementExpiration(key, seconds) {\n    // implement incrementExpiration\n    return this\n  }\n\n  /**\n   * Get number of seconds left until cache data is cleared.\n   * @param {String} key\n   *\n   * @return {Integer}\n   */\n  secondsToExpiration(key) {\n    // implement secondsToExpiration\n  }\n}\n```\n\nThen in `start/hooks.js`, register your driver:\n\n```js\n'use strict'\n\nconst { ioc } = require('@adonisjs/fold')\nconst { hooks } = require('@adonisjs/ignitor')\nconst Memcached = require('./lib/drivers/memcached')\n\nhooks.after.providersRegistered(() =\u003e {\n  const ThrottleManager = use('Adonis/Addons/ThrottleManager')\n  ThrottleManager.extend('memcached', Memcached)\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasasron%2Fadonis-throttle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasasron%2Fadonis-throttle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasasron%2Fadonis-throttle/lists"}