envelop
envelop copied to clipboard
Plugin idea: rate-limit based on query complexity
Based on: https://github.com/dotansimha/envelop/pull/474#issuecomment-885756213
Hi we wants to implement using envelop complexity rate limit similar to https://shopify.engineering/rate-limiting-graphql-apis-calculating-query-complexity (additional example in Monday API rate limit)
A bit more context on our use case, we open public GraphQL API and want that each api token will have budget per timeframe like minute/hour.
@idanwe I already started working on this, but haven't gotten back to it yet, I hopt to pick it up soon. This is something we really need for everyone!
@idanwe I just opened a pull request for this over here: https://github.com/dotansimha/envelop/pull/671
I did not start writing any documentation, but you can already have a look at the test cases :)
I think this plugin should replace https://github.com/dotansimha/envelop/pull/474 as it supports both being used to apply complexity rules for a single operation as well as apply complexity rules over a timeframe. The latter is opt-in.