AfterShip/rate-limiter ? reverse-engineered prompt

Reverse engineered prompt

Build me a small Node.js library that rate limits requests using Redis with an ioredis client.

I want to be able to create a limiter for a specific key, set a request limit and time window, then call a method that tells me how many requests are left and when the limit resets. If the user is over the limit, it should clearly tell me that too, so I can block the action or show a friendly message. Please include a simple example showing how to connect to Redis, create the limiter, and check whether a request can go through.

Keep it lightweight and easy to use, with sensible defaults, but let me override the limit and duration when needed. If anything in the current docs is unclear, look up the current ioredis usage online if you need to. Also add basic tests and make sure the package is ready to publish like a normal open source utility.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab