Skip to content

feat(cloudflare): add Rate Limit binding#287

Closed
Dawsson wants to merge 1 commit into
alchemy-run:mainfrom
Dawsson:codex/cloudflare-rate-limit-binding
Closed

feat(cloudflare): add Rate Limit binding#287
Dawsson wants to merge 1 commit into
alchemy-run:mainfrom
Dawsson:codex/cloudflare-rate-limit-binding

Conversation

@Dawsson
Copy link
Copy Markdown
Contributor

@Dawsson Dawsson commented May 8, 2026

Issue

Alchemy v2 could not model a Cloudflare Workers Rate Limiting binding. Cloudflare configures this through Worker metadata as a ratelimit binding with namespace_id and a simple limit window. The runtime binding exposes limit({ key }).

Docs:

Solution

  • Add Cloudflare.RateLimit as a pure Worker binding marker.
  • Emit { type: "ratelimit", name, namespaceId, simple } in Worker metadata.
  • Include Rate Limit in Cloudflare.InferEnv as RateLimit.

Validation

  • node_modules/.bin/oxfmt packages/alchemy/src/Cloudflare/RateLimit/RateLimit.ts packages/alchemy/src/Cloudflare/RateLimit/index.ts packages/alchemy/src/Cloudflare/index.ts packages/alchemy/src/Cloudflare/Workers/Worker.ts packages/alchemy/src/Cloudflare/Workers/InferEnv.ts
  • node_modules/.bin/tsc -b packages/alchemy/tsconfig.json --pretty false
  • git diff --check

@Dawsson
Copy link
Copy Markdown
Contributor Author

Dawsson commented May 8, 2026

Closing this in favor of #238. That PR covers the same Rate Limit binding support and is more complete: it includes the binding policy, init-phase RateLimit.bind(...) path, provider wiring, and tests.

@Dawsson Dawsson closed this May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant