{"repo":"ravangen/graphql-rate-limit","free":true,"listed":false,"github":"https://github.com/ravangen/graphql-rate-limit","clone":"git clone https://github.com/ravangen/graphql-rate-limit.git","description":"🚦 Fixed window rate limiting middleware for GraphQL. Use to limit repeated requests to queries and mutations.","language":"TypeScript","stars":318,"topics":["graphql","graphql-directive","rate-limiter","typescript","javascript","nodejs"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"GraphQL Rate Limit Fixed window rate limiting directive for GraphQL. Use to limit repeated requests to queries and mutations. Features - 👨‍💻 Identification : Distinguish requests using resolver data - 🎯 Per-Object or Per-Field : Limit by objects and specific fields - 📦 Storage : Supports multiple data store choices ( Redis , process Memory , ...) - ♾️ Throttles : Define any number of limits per field - ⚙️ Extensions : Granular customization of field and response behaviour - 😍 TypeScript : Written in and exports type definitions Install You must also install peer dependencies: How it works GraphQL Rate Limit wraps resolvers, ensuring an action is permitted before it is invoked. A client is allocated a maximum of n operations for every fixed size time window. Once the client has performed n operations, they must wait. Setup Step 1: Define directive type definition and transformer Import rateLimitDirective and configure behaviour of directive (see options). Step 2: Add directive to schema Include rateLimitDirectiveTypeDefs as part of the schema's type definitions. Transform schema with rateLimitDirectiveTransformer to apply implementation of directive. Step 3: Attach directive to field or object Attach @rateLimit directive where desired. Argument limit is number of allow operations per duration. Argument duration is the length of the fixed window (in seconds). Overrides When the directive is applied to a object, it rate limits each of its fields. A rate limit on a field wil","default_branch":null,"files":null,"tree":[],"storefront":"/r/ravangen","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ravangen/graphql-rate-limit/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}