{"id":18926839,"url":"https://github.com/ladjs/koa-redis-ratelimit","last_synced_at":"2026-03-01T04:34:15.426Z","repository":{"id":57289427,"uuid":"63923978","full_name":"ladjs/koa-redis-ratelimit","owner":"ladjs","description":"*DOES NOT WORK DUE TO `ratelimiter`, PLEASE USE https://github.com/scttcper/koa-simple-ratelimit INSTEAD* Rate limiting middleware backed by Redis for Koa v2+, built for :crocodile: CrocodileJS","archived":false,"fork":false,"pushed_at":"2023-01-10T00:03:14.000Z","size":8,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T23:38:19.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://crocodilejs.com","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/ladjs.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":"2016-07-22T04:37:54.000Z","updated_at":"2022-03-17T19:24:04.000Z","dependencies_parsed_at":"2023-02-08T16:01:44.172Z","dependency_job_id":null,"html_url":"https://github.com/ladjs/koa-redis-ratelimit","commit_stats":null,"previous_names":["niftylettuce/koa-ratelimit-promises","niftylettuce/koa-redis-ratelimit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ladjs/koa-redis-ratelimit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-redis-ratelimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-redis-ratelimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-redis-ratelimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-redis-ratelimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/koa-redis-ratelimit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fkoa-redis-ratelimit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271732419,"owners_count":24811320,"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-08-23T02:00:09.327Z","response_time":69,"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-11-08T11:17:19.535Z","updated_at":"2026-03-01T04:34:10.403Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# koa-redis-ratelimit\n\n[![Slack Status][slack-image]][slack-url]\n[![NPM version][npm-image]][npm-url]\n[![Build Status][build-image]][build-url]\n[![Code Coverage][codecoverage-image]][codecoverage-url]\n[![Standard JS Style][standard-image]][standard-url]\n[![MIT License][license-image]][license-url]\n\n\u003e Rate limiting middleware backed by Redis for Koa v2+, built for [CrocodileJS][crocodile-url].\n\n---\n\n**NOTE: Currently this package does not work due to an issue with `ratelimiter`, please use \u003chttps://github.com/scttcper/koa-simple-ratelimit\u003e instead**\n\n---\n\n## Install\n\n```bash\nnpm install --save koa-redis-ratelimit\n```\n\n\n## Usage\n\n```js\nimport RateLimit from 'koa-redis-ratelimit';\nimport redis from 'redis';\nimport Koa from 'koa';\n\nconst app = new Koa();\n\n// apply rate limit\napp.use(new Ratelimit({\n  db: redis.createClient(),\n  duration: 60000,\n  max: 100,\n  id: (ctx) =\u003e ctx.ip,\n  blacklist: [],\n  whitelist: []\n}).middleware);\n\n// response middleware\napp.use(ctx =\u003e {\n  ctx.body = 'Stuff!';\n});\n\napp.listen(3000);\nconsole.log('listening on port 3000');\n```\n\n\n## Options\n\n* `db` - redis connection instance\n* `max` - max requests within `duration` (default is `2500`)\n* `duration` - of limit in milliseconds (default is `3600000`)\n* `id` - id to compare requests [ip]\n* `whitelist` - array of ids to whitelist\n* `blacklist` - array of ids to blacklist\n\n\n# Responses\n\n\u003e Example 200 with header fields:\n\n```log\nHTTP/1.1 200 OK\nX-Powered-By: koa\nX-RateLimit-Limit: 100\nX-RateLimit-Remaining: 99\nX-RateLimit-Reset: 1384377793\nContent-Type: text/plain; charset=utf-8\nContent-Length: 6\nDate: Wed, 13 Nov 2013 21:22:13 GMT\nConnection: keep-alive\n\nStuff!\n```\n\n\u003e Example 429 response:\n\n```log\nHTTP/1.1 429 Too Many Requests\nX-Powered-By: koa\nX-RateLimit-Limit: 100\nX-RateLimit-Remaining: 0\nX-RateLimit-Reset: 1384377716\nContent-Type: text/plain; charset=utf-8\nContent-Length: 39\nRetry-After: 7\nDate: Wed, 13 Nov 2013 21:21:48 GMT\nConnection: keep-alive\n\nRate limit exceeded, retry in 8 seconds\n```\n\n\n## License\n\n[MIT][license-url]\n\n\n[license-image]: http://img.shields.io/badge/license-MIT-blue.svg\n[license-url]: LICENSE\n[npm-image]: https://img.shields.io/npm/v/koa-redis-ratelimit.svg\n[npm-url]: https://npmjs.org/package/koa-redis-ratelimit\n[crocodile-url]: https://crocodilejs.com\n[standard-image]: https://img.shields.io/badge/code%20style-standard%2Bes7-brightgreen.svg\n[standard-url]: https://github.com/crocodilejs/eslint-config-crocodile\n[slack-image]: http://slack.crocodilejs.com/badge.svg\n[slack-url]: http://slack.crocodilejs.com\n[build-image]: https://semaphoreci.com/api/v1/niftylettuce/koa-redis-ratelimit/branches/master/shields_badge.svg\n[build-url]: https://semaphoreci.com/niftylettuce/koa-redis-ratelimit\n[codecoverage-image]: https://codecov.io/gh/niftylettuce/koa-redis-ratelimit/branch/master/graph/badge.svg\n[codecoverage-url]: https://codecov.io/gh/niftylettuce/koa-redis-ratelimit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fkoa-redis-ratelimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fkoa-redis-ratelimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fkoa-redis-ratelimit/lists"}