{"id":15176862,"url":"https://github.com/onur-ozkan/nestjs-rate-limiter","last_synced_at":"2025-10-01T16:30:40.820Z","repository":{"id":40679773,"uuid":"193093674","full_name":"onur-ozkan/nestjs-rate-limiter","owner":"onur-ozkan","description":"Highly configurable and extensible rate limiter library","archived":true,"fork":false,"pushed_at":"2022-11-16T10:25:50.000Z","size":610,"stargazers_count":241,"open_issues_count":14,"forks_count":43,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-20T04:37:10.066Z","etag":null,"topics":["guard","nestjs","rate-limiter","request-limiter","security"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/nestjs-rate-limiter","language":"TypeScript","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/onur-ozkan.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":"2019-06-21T12:24:06.000Z","updated_at":"2025-06-15T08:25:59.000Z","dependencies_parsed_at":"2023-01-22T11:30:49.028Z","dependency_job_id":null,"html_url":"https://github.com/onur-ozkan/nestjs-rate-limiter","commit_stats":null,"previous_names":["onur-ozkan/nestjs-rate-limiter","ozkanonur/nestjs-rate-limiter","ryantheallmighty/nestjs-rate-limiter"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/onur-ozkan/nestjs-rate-limiter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onur-ozkan%2Fnestjs-rate-limiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onur-ozkan%2Fnestjs-rate-limiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onur-ozkan%2Fnestjs-rate-limiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onur-ozkan%2Fnestjs-rate-limiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onur-ozkan","download_url":"https://codeload.github.com/onur-ozkan/nestjs-rate-limiter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onur-ozkan%2Fnestjs-rate-limiter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277103489,"owners_count":25761398,"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-26T02:00:09.010Z","response_time":78,"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":["guard","nestjs","rate-limiter","request-limiter","security"],"created_at":"2024-09-27T14:00:23.862Z","updated_at":"2025-10-01T16:30:40.555Z","avatar_url":"https://github.com/onur-ozkan.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"## No longer maintained\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"30%\" src=\"https://user-images.githubusercontent.com/39852038/91653275-d14ace00-eaa7-11ea-9654-492cca9506d5.png\" /\u003e\n\u003c/p\u003e\n\n\u003ch2 align=\"center\"\u003eRate Limiter Module for NestJS\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter\"\u003e\u003cimg src=\"https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter/badge?sanitize=true\" alt=\"Code Quality\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/nestjs-rate-limiter\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/nestjs-rate-limiter.svg?sanitize=true\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/nestjs-rate-limiter\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/nestjs-rate-limiter.svg?sanitize=true\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/nestjs-rate-limiter.svg?colorB=black\u0026label=LICENSE\u0026sanitize=true\" alt=\"License\"/\u003e\u003c/a\u003e\n\u003ca href=\"#\"\u003e\u003cimg src=\"https://github.com/ozkanonur/nestjs-rate-limiter/actions/workflows/test.yml/badge.svg?branch=master\" alt=\"Test\"/\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n# Documentation Map\n- [Description](https://github.com/ozkanonur/nestjs-rate-limiter#description)\n- [Installation](https://github.com/ozkanonur/nestjs-rate-limiter#installation)\n- [Basic Usage](https://github.com/ozkanonur/nestjs-rate-limiter#basic-usage)\n  - [Include Module](https://github.com/ozkanonur/nestjs-rate-limiter#include-module)\n  - [Using Guard](https://github.com/ozkanonur/nestjs-rate-limiter#using-guard)\n  - [With Decorator](https://github.com/ozkanonur/nestjs-rate-limiter#with-decorator)\n  - [With All Options](https://github.com/ozkanonur/nestjs-rate-limiter#with-all-options)\n  - [Fastify based Graphql](https://github.com/ozkanonur/nestjs-rate-limiter#fastify-based-graphql)\n- [Options](https://github.com/ozkanonur/nestjs-rate-limiter#options)\n  - [for](https://github.com/ozkanonur/nestjs-rate-limiter#-for)\n  - [type](https://github.com/ozkanonur/nestjs-rate-limiter#-type)\n  - [keyPrefix](https://github.com/ozkanonur/nestjs-rate-limiter#-keyPrefix)\n  - [points](https://github.com/ozkanonur/nestjs-rate-limiter#-points)\n  - [pointsConsumed](https://github.com/ozkanonur/nestjs-rate-limiter#-pointsConsumed)\n  - [inmemoryBlockOnConsumed](https://github.com/ozkanonur/nestjs-rate-limiter#-inmemoryBlockOnConsumed)\n  - [duration](https://github.com/ozkanonur/nestjs-rate-limiter#-duration)\n  - [blockDuration](https://github.com/ozkanonur/nestjs-rate-limiter#-blockDuration)\n  - [inmemoryBlockDuration](https://github.com/ozkanonur/nestjs-rate-limiter#-inmemoryBlockDuration)\n  - [queueEnabled](https://github.com/ozkanonur/nestjs-rate-limiter#-queueEnabled)\n  - [whiteList](https://github.com/ozkanonur/nestjs-rate-limiter#-whiteList)\n  - [blackList](https://github.com/ozkanonur/nestjs-rate-limiter#-blackList)\n  - [storeClient](https://github.com/ozkanonur/nestjs-rate-limiter#-storeClient)\n  - [insuranceLimiter](https://github.com/ozkanonur/nestjs-rate-limiter#-insuranceLimiter)\n  - [storeType](https://github.com/ozkanonur/nestjs-rate-limiter#-storeType)\n  - [dbName](https://github.com/ozkanonur/nestjs-rate-limiter#-dbName)\n  - [tableName](https://github.com/ozkanonur/nestjs-rate-limiter#-tableName)\n  - [tableCreated](https://github.com/ozkanonur/nestjs-rate-limiter#-tableCreated)\n  - [clearExpiredByTimeout](https://github.com/ozkanonur/nestjs-rate-limiter#-clearExpiredByTimeout)\n  - [execEvenly](https://github.com/ozkanonur/nestjs-rate-limiter#-execEvenly)\n  - [execEvenlyMinDelayMs](https://github.com/ozkanonur/nestjs-rate-limiter#-execEvenlyMinDelayMs)\n  - [indexKeyPrefix](https://github.com/ozkanonur/nestjs-rate-limiter#-indexKeyPrefix)\n  - [maxQueueSize](https://github.com/ozkanonur/nestjs-rate-limiter#-maxQueueSize)\n  - [omitResponseHeaders](https://github.com/ozkanonur/nestjs-rate-limiter#-omitResponseHeaders)\n  - [errorMessage](https://github.com/ozkanonur/nestjs-rate-limiter#-errorMessage)\n  - [customResponseSchema](https://github.com/ozkanonur/nestjs-rate-limiter#-customResponseSchema)\n- [Override Functions](https://github.com/ozkanonur/nestjs-rate-limiter#override-functions)\n- [Benchmarks](https://github.com/ozkanonur/nestjs-rate-limiter#benchmarks)\n- [TODO List](https://github.com/ozkanonur/nestjs-rate-limiter#todo)\n\n# Description\n\n`nestjs-rate-limiter` is a module which adds in configurable rate limiting for [Nest](https://github.com/nestjs/nest) applications.\n\nUnder the hood it uses [rate-limiter-flexible](https://github.com/animir/node-rate-limiter-flexible).\n\n# Installation\n\n```bash\nnpm i --save nestjs-rate-limiter\n```\n\nOr if you use Yarn:\n\n```bash\nyarn add nestjs-rate-limiter\n```\n\n# Requirements\n\n`nestjs-rate-limiter` is built to work with Nest 6 and newer versions.\n\n# Basic Usage\n\n### Include Module\n\nFirst you need to import this module into your main application module:\n\n\u003e app.module.ts\n\n```ts\nimport { RateLimiterModule } from 'nestjs-rate-limiter'\n\n@Module({\n    imports: [RateLimiterModule],\n})\nexport class ApplicationModule {}\n```\n\n### Using Guard\n\nNow you need to register the guard. You can do this only on some routes:\n\n\u003e app.controller.ts\n\n```ts\nimport { RateLimiterGuard } from 'nestjs-rate-limiter'\n\n@UseGuards(RateLimiterGuard)\n@Get('/login')\npublic async login() {\n    console.log('hello')\n}\n```\n\nOr you can choose to register the guard globally:\n\n\u003e app.module.ts\n\n```ts\nimport { APP_GUARD } from '@nestjs/core'\nimport { RateLimiterModule, RateLimiterGuard } from 'nestjs-rate-limiter'\n\n@Module({\n    imports: [RateLimiterModule],\n    providers: [\n        {\n            provide: APP_GUARD,\n            useClass: RateLimiterGuard,\n        },\n    ],\n})\nexport class ApplicationModule {}\n```\n\n### With Decorator\n\nYou can use the `@RateLimit` decorator to specify the points and duration for rate limiting on a per controller or per\nroute basis:\n\n\u003e app.controller.ts\n\n```ts\nimport { RateLimit } from 'nestjs-rate-limiter'\n\n@RateLimit({ keyPrefix: 'sign-up', points: 1, duration: 60, errorMessage: 'Accounts cannot be created more than once in per minute' })\n@Get('/signup')\npublic async signUp() {\n    console.log('hello')\n}\n```\n\n### Dynamic Keyprefix\n\n```ts\nimport { RateLimit } from 'nestjs-rate-limiter'\n\n@RateLimit({\n  keyPrefix: () =\u003e programmaticFuncThatReturnsValue(),\n  points: 1,\n  duration: 60,\n  customResponseSchema: () =\u003e { return { timestamp: '1611479696', message: 'Request has been blocked' }}\n})\n@Get('/example')\npublic async example() {\n    console.log('hello')\n}\n```\n\n### With All Options\n\nThe usage of the limiter options is as in the code block below. For an explanation of the each option, please see \u003ccode\u003e[options](https://github.com/ozkanonur/nestjs-rate-limiter#options)\u003c/code\u003e.\n\n```ts\n@Module({\n    imports: [\n        // All the values here are defaults.\n        RateLimiterModule.register({\n            for: 'Express',\n            type: 'Memory',\n            keyPrefix: 'global',\n            points: 4,\n            pointsConsumed: 1,\n            inmemoryBlockOnConsumed: 0,\n            duration: 1,\n            blockDuration: 0,\n            inmemoryBlockDuration: 0,\n            queueEnabled: false,\n            whiteList: [],\n            blackList: [],\n            storeClient: undefined,\n            insuranceLimiter: undefined,\n            storeType: undefined,\n            dbName: undefined,\n            tableName: undefined,\n            tableCreated: undefined,\n            clearExpiredByTimeout: undefined,\n            execEvenly: false,\n            execEvenlyMinDelayMs: undefined,\n            indexKeyPrefix: {},\n            maxQueueSize: 100,\n            omitResponseHeaders: false,\n            errorMessage: 'Rate limit exceeded',\n            logger: true,\n            customResponseSchema: undefined\n        }),\n    ],\n    providers: [\n        {\n            provide: APP_GUARD,\n            useClass: RateLimiterGuard,\n        },\n    ],\n})\nexport class ApplicationModule {}\n```\n\n### Fastify based Graphql\nIf you want to use this library on a fastify based graphql server, you need to override the graphql context in the app.module as shown below.\n```ts\nGraphQLModule.forRoot({\n    context: ({ request, reply }) =\u003e {\n        return { req: request, res: reply }\n    },\n}),\n```\n\n# Options\n\n#### ● for\n  \u003ccode\u003e Default: 'Express'\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: 'Express' | 'Fastify' | 'Microservice' | 'ExpressGraphql' | 'FastifyGraphql'\u003c/code\u003e\n  \u003cbr\u003e\n\n  In this option, you specify what the technology is running under the Nest application. The wrong value causes to limiter not working.\n\n#### ● type\n  \u003ccode\u003e Default: 'Memory'\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: 'Memory' | 'Redis' | 'Memcache' | 'Postgres' | 'MySQL' | 'Mongo'\u003c/code\u003e\n  \u003cbr\u003e\n\n  Here you define where the limiter data will be stored. Each option plays a different role in limiter performance, to see that please check [benchmarks](https://github.com/ozkanonur/nestjs-rate-limiter#benchmarks).\n\n#### ● keyPrefix\n  \u003ccode\u003e Default: 'global'\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string\u003c/code\u003e\n  \u003cbr\u003e\n\n  For creating several limiters with different options to apply different modules/endpoints.\n\n  Set to empty string '', if keys should be stored without prefix.\n\n  Note: for some limiters it should correspond to Storage requirements for tables or collections name, as keyPrefix may be used as their name.\n\n#### ● points\n  \u003ccode\u003e Default: 4\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  Maximum number of points can be consumed over duration.\n\n#### ● pointsConsumed\n  \u003ccode\u003e Default: 1\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  You can consume more than 1 point per invocation of the rate limiter.\n\n  For instance if you have a limit of 100 points per 60 seconds, and pointsConsumed is set to 10, the user will effectively be able to make 10 requests per 60 seconds.\n\n#### ● inmemoryBlockOnConsumed\n  \u003ccode\u003e Default: 0\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  For Redis, Memcached, MongoDB, MySQL, PostgreSQL, etc.\n\n  Can be used against DDoS attacks. In-memory blocking works in current process memory and for consume method only.\n\n  It blocks a key in memory for msBeforeNext milliseconds from the last consume result, if inmemoryBlockDuration is not set. This helps to avoid extra requests.\n  It is not necessary to increment counter on store, if all points are consumed already.\n\n#### ● duration\n  \u003ccode\u003e Default: 1\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  Number of seconds before consumed points are reset.\n\n  Keys never expire, if duration is 0.\n\n#### ● blockDuration\n  \u003ccode\u003e Default: 0\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  If positive number and consumed more than points in current duration, block for blockDuration seconds.\n\n#### ● inmemoryBlockDuration\n  \u003ccode\u003e Default: 0\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  For Redis, Memcached, MongoDB, MySQL, PostgreSQL, etc.\n\n  Block key for inmemoryBlockDuration seconds, if inmemoryBlockOnConsumed or more points are consumed. Set it the same as blockDuration option for distributed application to have consistent result on all processes.\n\n#### ● queueEnabled\n  \u003ccode\u003e Default: false\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  It activates the queue mechanism, and holds the incoming requests for \u003ccode\u003eduration\u003c/code\u003e value.\n\n#### ● whiteList\n  \u003ccode\u003e Default: []\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string[]\u003c/code\u003e\n  \u003cbr\u003e\n\n  If the IP is white listed, consume resolved no matter how many points consumed.\n\n#### ● blackList\n  \u003ccode\u003e Default: []\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string[]\u003c/code\u003e\n  \u003cbr\u003e\n\n  If the IP is black listed, consume rejected anytime. Blacklisted IPs are blocked on code level not in store/memory. Think of it as of requests filter.\n\n#### ● storeClient\n  \u003ccode\u003e Default: undefined\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: any\u003c/code\u003e\n  \u003cbr\u003e\n\n  Required for Redis, Memcached, MongoDB, MySQL, PostgreSQL, etc.\n\n  Have to be redis, ioredis, memcached, mongodb, pg, mysql2, mysql or any other related pool or connection.\n\n#### ● insuranceLimiter\n  \u003ccode\u003e Default: undefined\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: any\u003c/code\u003e\n  \u003cbr\u003e\n\n  Default: undefined For Redis, Memcached, MongoDB, MySQL, PostgreSQL.\n\n  Instance of RateLimiterAbstract extended object to store limits, when database comes up with any error.\n\n  All data from insuranceLimiter is NOT copied to parent limiter, when error gone\n\n  Note: insuranceLimiter automatically setup blockDuration and execEvenly to same values as in parent to avoid unexpected behaviour.\n\n#### ● storeType\n  \u003ccode\u003e Default: storeClient.constructor.name\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: any\u003c/code\u003e\n  \u003cbr\u003e\n\n  For MySQL and PostgreSQL\n  It is required only for Knex and have to be set to 'knex'\n\n#### ● dbName\n  \u003ccode\u003e Default for MySQL, Postgres \u0026 Mongo: 'rate-limiter'\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string\u003c/code\u003e\n  \u003cbr\u003e\n\n  Database where limits are stored. It is created during creating a limiter. Doesn't work with Mongoose, as mongoose connection is established to exact database.\n\n#### ● tableName\n  \u003ccode\u003e Default: equals to 'keyPrefix' option\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string\u003c/code\u003e\n  \u003cbr\u003e\n\n  For MongoDB, MySQL, PostgreSQL.\n\n  By default, limiter creates a table for each unique keyPrefix. tableName option sets table/collection name where values should be store.\n\n#### ● tableCreated\n  \u003ccode\u003e Default: false\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  Does not create a table for rate limiter, if tableCreated is \u003ccode\u003etrue\u003c/code\u003e.\n\n#### ● clearExpiredByTimeout\n  \u003ccode\u003e Default for MySQL and PostgreSQL: true\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  Rate limiter deletes data expired more than 1 hour ago every 5 minutes.\n\n#### ● execEvenly\n  \u003ccode\u003e Default: false\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  Delay action to be executed evenly over duration First action in duration is executed without delay. All next allowed actions in current duration are delayed by formula msBeforeDurationEnd / (remainingPoints + 2) with minimum delay of duration * 1000 / points It allows to cut off load peaks similar way to Leaky Bucket.\n\n  Note: it isn't recommended to use it for long duration and few points, as it may delay action for too long with default execEvenlyMinDelayMs.\n\n#### ● execEvenlyMinDelayMs\n  \u003ccode\u003e Default: duration * 1000 / points\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  Sets minimum delay in milliseconds, when action is delayed with execEvenly\n\n#### ● indexKeyPrefix\n  \u003ccode\u003e Default: {}\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: {}\u003c/code\u003e\n  \u003cbr\u003e\n\n  Object which is used to create combined index by {...indexKeyPrefix, key: 1} attributes.\n\n#### ● maxQueueSize\n  \u003ccode\u003e Default: 100\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: number\u003c/code\u003e\n  \u003cbr\u003e\n\n  Determines the maximum number of requests in the queue and returns \u003ccode\u003e429\u003c/code\u003e as response to requests that over of the maxQueueSize.\n\n#### ● omitResponseHeaders\n  \u003ccode\u003e Default: false\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  Whether or not the rate limit headers (\u003ccode\u003eX-Retry-After\u003c/code\u003e, \u003ccode\u003eX-RateLimit-Limit\u003c/code\u003e, \u003ccode\u003eX-Retry-Remaining\u003c/code\u003e, \u003ccode\u003eX-Retry-Reset\u003c/code\u003e) should be omitted in the response.\n\n\n#### ● errorMessage\n  \u003ccode\u003e Default: 'Rate limit exceeded'\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string\u003c/code\u003e\n  \u003cbr\u003e\n\n  errorMessage option can change the error message of rate limiter exception.\n\n#### ● logger\n  \u003ccode\u003e Default: true\u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: boolean\u003c/code\u003e\n  \u003cbr\u003e\n\n  logger option allows to enable or disable logging from library.\n\n  #### ● customResponseSchema\n  \u003ccode\u003e Default: undefined \u003c/code\u003e\n  \u003cbr\u003e\n  \u003ccode\u003e Type: string\u003c/code\u003e\n  \u003cbr\u003e\n\n  customResponseSchema option allows to provide customizable response schemas\n\n# Override Functions\n\nIt's possible to override \u003ccode\u003egetIpFromRequest\u003c/code\u003e function by extending \u003ccode\u003eRateLimiterGuard\u003c/code\u003e class.\n\n```ts\nimport { RateLimiterGuard } from 'nestjs-rate-limiter'\nimport type { Request } from 'express'\n\nclass ExampleRateLimiterGuard extends RateLimiterGuard {\n  protected getIpFromRequest(request: Request): string {\n    return request.get('x-forwarded-for');\n  }\n}\n```\n\n# Benchmarks\n\n1000 concurrent clients with maximum 2000 requests per sec during 30 seconds.\n\n```\n1. Memory     0.34 ms\n2. Redis      2.45 ms\n3. Memcached  3.89 ms\n4. Mongo      4.75 ms\n```\n\n500 concurrent clients with maximum 1000 req per sec during 30 seconds\n\n```\n5. PostgreSQL 7.48 ms (with connection pool max 100)\n6. MySQL     14.59 ms (with connection pool 100)\n```\n\n## TODO\n- [ ] Support Websocket\n- [ ] Support Rpc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonur-ozkan%2Fnestjs-rate-limiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonur-ozkan%2Fnestjs-rate-limiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonur-ozkan%2Fnestjs-rate-limiter/lists"}