Skip to content

maxwellgerber/launchdarkly-ratelimit-demo

Repository files navigation

LaunchDarkly Ratelimit Demo

Example Express app that shows how to use LaunchDarkly's node SDK as a rate limit provider for express-rate-limit.

This shows how LaunchDarkly operational feature flags can be used for service protection. Here - we allow detailed targeting at the user or customer account level.

In order to make this example production-ready, the following changes must be made:

  1. Rate limiting should be unique per endpoint, or class of endpoints
  2. Replace the in-memory store with a redis store
  3. Consider rate limiting un-authenticated requests as well

Accompanying LaunchDarkly Setup

  1. Create a single feature flag called rate-limiting
  2. Create the following rules
Name Count
Suspended 1
Low 3
High 10
Unlimited -1
  1. Add user targeting so alice is served the Suspended variation
  2. Add user targeting so max is served the Unlimited variation
  3. Add rule targeting so customerAccountId=2 is served the High variation

About

Ratelimit demo for Launchdarkly's Trajectory Conf

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published