learn hapi — Dynamic Rate Limits (Part 3 of 7)

Your rate limiter grows in functionality. You already built an IP-based rate limiting that is configurable for each route. The route limits let you configure an individual rate limit for a route that differs from the server’s default rate limit.

Another aspect of rate limiting is dynamic rate limiting. Imagine dynamic rate limits as limits that vary between users. For example, varying limits between users occur on SaaS subscriptions where you can increase your volume with a higher tier. Depending on the user’s tier, the rate limit may range from hundreds to thousands, to even millions of requests (per month).

Example: tiered pricing with increasing rate limits

In case you need a glimpse on the complete package code: it’s available on GitHub in the hapi-rate-limitor repository and on NPM at hapi-rate-limitor.

hapi Series Overview


Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $15/mo

Explore the Library

Find interesting tutorials and solutions for your problems.