{"id":15043554,"url":"https://github.com/cnpm/koa-limit","last_synced_at":"2025-09-04T18:38:55.703Z","repository":{"id":14934598,"uuid":"17659076","full_name":"cnpm/koa-limit","owner":"cnpm","description":"koa middleware for limiting requests by ip","archived":false,"fork":false,"pushed_at":"2019-11-06T19:43:20.000Z","size":22,"stargazers_count":31,"open_issues_count":5,"forks_count":2,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-08-15T06:58:43.909Z","etag":null,"topics":[],"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/cnpm.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2014-03-12T07:41:04.000Z","updated_at":"2022-11-15T12:43:27.000Z","dependencies_parsed_at":"2022-09-02T03:22:08.712Z","dependency_job_id":null,"html_url":"https://github.com/cnpm/koa-limit","commit_stats":null,"previous_names":["dead-horse/koa-limit"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cnpm/koa-limit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnpm%2Fkoa-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnpm%2Fkoa-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnpm%2Fkoa-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnpm%2Fkoa-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnpm","download_url":"https://codeload.github.com/cnpm/koa-limit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnpm%2Fkoa-limit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273656088,"owners_count":25144998,"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-09-04T02:00:08.968Z","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":[],"created_at":"2024-09-24T20:49:15.686Z","updated_at":"2025-09-04T18:38:55.637Z","avatar_url":"https://github.com/cnpm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"koa-limit [![Build Status](https://travis-ci.org/koajs/koa-limit.png)](https://travis-ci.org/koajs/koa-limit)\n=========\n\nkoa middleware for limit request by ip\n\n## Install\n\n```\nnpm install koa-limit\n```\n\n## Usage\n\n```js\nvar koa = require('koa');\nvar favicon = require('koa-favicon');\nvar limit = require('./');\n\nvar app = koa();\n// If you are using reverse proxy on the front of node, like 'nginx', please set this\n// app.proxy = true;\napp.use(favicon());\napp.use(limit({\n  limit: 1000,\n  interval: 1000 * 60 * 60\n}));\n\napp.use(function *() {\n  this.body = 'hello';\n});\n\napp.listen(7001);\n```\n\n### Options\n\n* **limit**: limit request number, default is 1000.\n* **interval**: limit refresh interval in ms, default is one day.\n* **token**: prefix key, for isolate different koa-limit, default is `koa-limit`, if you want to use more than one `koa-limit` in a project, you must set different token!!\n* **store**: can be set with a redis store, or other store with API in [MemoryStore](https://github.com/koajs/koa-limit/blob/master/lib/memory_store.js). default store is `MemoryStore`.\n* **whiteList**: all ips in whiteList won't be limited.\n* **blackList**: all ips in blackList will 403.\n* **message**: forbidden message, defautl is 'request frequency limited'.\n\n### Redis Store\n\ncheckout the [example.js](https://github.com/koajs/koa-limit/blob/master/example.js), see how to use `koa-limit` with redis.\n\n### Different with [koa-ratelimit](https://github.com/koajs/ratelimit)\n\n1. you can use memory to store all these rates.\n2. support `whiteList` and `blackList`\n3. easy to store in other DBs.\n4. message customable\n\n## Authors\n\n```\n$ git summary\n\n project  : koa-limit\n repo age : 2 days ago\n commits  : 21\n active   : 2 days\n files    : 15\n authors  :\n    19  dead_horse              90.5%\n     1  Po-Ying Chen            4.8%\n     1  fengmk2                 4.8%\n```\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 dead_horse\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.%\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnpm%2Fkoa-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnpm%2Fkoa-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnpm%2Fkoa-limit/lists"}