I’m looking to use Workers for my next project, and basically since its an API I do require some basic stuff like authorization and rate limiting. I saw authorization can be done with Workers KV, but is there any way to do Rate Limiting (Per API Key/Api user)? I also saw that only HTTP connections are allowed from workers, so that also means that I can’t use something like Redis, and http overhead for something like that, for every request is just too much.
Does anyone have a solution to this, or its just not possible to achieve with Workers?
That would be custom code from your side, right?
You can use it is as data store, but KV itself does not handle authorisation. Again, custom code.
Custom code again.
Unlikely. If you need to store data you should go the KV route.
It can be done, depending on what you want to do I am just not sure if Workers are the right tool. As long as you do everything via KV you should be fine. Keep in mind you’ll also have CPU time restrictions.
I’m aware that you need to write custom code. I’m not sure you understood me correctly. Workers KV has a limitation that only 1 write /s is allowed, among other limitations that would make it not suitable for rate limiting. Thats why I was asking if anyone had some experience with this issue.
So your concern is not how to implement rate limiting (you seem to have asked that) but rather if KV would rate limit your code?
I know how to implement rate limiting, my concern is, would it be possible with KV considering its limitations, and if not did anyone else try to do it an how they manged to do it since Workers only support Http connections