Skip to content

Home > @opengovsg/rate-limit > RateLimitConfig

RateLimitConfig interface ​

Configuration for a rate-limit window. Omitted fields inherit the limiter's defaults.

Signature:

typescript
export interface RateLimitConfig

Properties ​

PropertyModifiersTypeDescription
burst?BurstConfig | null

(Optional) Burst window layered on top of the steady window. Omit to inherit the limiter's default burst. Pass null to disable bursting entirely.

Disabled during a Redis outage, and when no client is configured.

duration?number(Optional) Steady window in seconds.
fallback?FallbackConfig(Optional) Fallback allowance for the in-memory limiter used as insurance during a Redis outage, and as the sole limiter when no client is configured.
points?number(Optional) Consumption points available per steady window.
prefix?string

(Optional) Namespace segment isolating this limiter's counters from other limiters sharing the same store.

By default, steady counters are stored under rate-limit:<prefix>: and burst counters under rate-limit-burst:<prefix>:.