Rate Limit
Redis Integration
Alpha
DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.
@dsar/redis provides Redis-backed DSAR runtime integrations. It currently
exports a Redis-backed RateLimitStore for public intake endpoints. Use it when
a runtime has multiple Node/server instances and the default in-memory store
would not share counters.
Install
ioredis is a peer dependency so host applications control the Redis client
version and connection setup.
Runtime Wiring
Behavior
- Uses the backend fixed-window rate-limit contract.
- Shares IP and tenant counters across runtime instances.
- Returns the same
429andRetry-Afterbehavior as the default store. - Automatically expires Redis keys after the configured window.
- Applies
keyPrefixbefore DSAR's route/scope key. Use an empty string only when the host application already namespaces keys.
Production Notes
- Use this package for Node/server deployments.
- Use
@dsar/upstashfor fetch/edge-oriented deployments. - Keep
config.rateLimit.onLimitExceededwired to your metrics pipeline when you need visibility into abusive or misconfigured public intake sources.