adobe / adobe/helix-shared

helix-shared-edge-ratelimit: unified rate limiting APIs

Open
#1,162 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
15
Forks
16
Avg merge
23h 18m
Merged PRs (30d)
14

Description

## Background

PR [#77](https://github.com/adobe/helix-deploy-plugin-edge/pull/77) identifies platform differences in rate limiting APIs. Per [comment](https://github.com/adobe/helix-deploy-plugin-edge/pull/77#issuecomment-3554569809), we need a unified wrapper/plugin in helix-shared.

## Platform Differences

**Fastly:**
- `EdgeRateLimiter` with `RateCounter` and `PenaltyBox`
- Synchronous, direct runtime calls
- Built-in penalty box enforcement
- Windows: 1s, 10s, 60s

**Cloudflare:**
- Binding-based rate limiting via `wrangler.toml`
- Async Promise API
- Eventually consistent per-location
- Windows: 10s, 60s only

## Requirements

1. Unified async interface supporting both platforms
2. Support common time windows (10s, 60s)
3. Penalty box abstraction (native on Fastly, KV/DO on Cloudflare)
4. Platform detection and appropriate delegation

## Implementation

Target: `packages/helix-shared-edge-ratelimit/`

Interface:
```javascript
interface UnifiedRateLimiter {
checkRate(key: string, options?: RateLimitOptions): Promise;
}
```

Platform-specific implementations behind unified API.

## Reference

Documentation analysis in [security-ratelimit.md](https://github.com/adobe/helix-deploy-plugin-edge/blob/compat/docs/api-unification/security-ratelimit.md)

Contributor guide

Open the contributing guide

Research direction

Start by reading docs/api-unification/security-ratelimit.md and PR #77, then inspect packages/helix-shared-edge-ratelimit/. Define the platform-specific delegation behind the stated unified async checkRate interface. Done means Fastly and Cloudflare support common 10s and 60s windows, platform detection, and the required penalty-box abstraction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend-api-design, cloud, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.