Migrated from DelegoLabs/Delego#443.
This issue belongs to the backend repository after the monorepo split.
Type
Task
Area
Backend / All Services
Complexity
Moderate
Problem
No service has rate limiting. Wallet, payments, orchestrator, and notification routes are all vulnerable to abuse and DDoS.
Implementation Scope
apps/backend/gateway/middleware/rateLimiter.ts (new)
- Apply to all service routes
Functions to Implement
- Create a sliding-window rate limiter using Redis.
- Default: 100 requests per minute per IP.
- Return 429 Too Many Requests with
Retry-After header when exceeded.
- Make limits configurable via env vars.
Tests
- Unit test: requests under limit pass through.
- Unit test: requests over limit return 429.
- Unit test: retry-after header is present.
Acceptance Criteria
- All service routes have rate limiting.
- Limits are configurable per service.
- 429 response includes retry-after.
Verification
pnpm test passes.
pnpm build completes.
Type
Task
Area
Backend / All Services
Complexity
Moderate
Problem
No service has rate limiting. Wallet, payments, orchestrator, and notification routes are all vulnerable to abuse and DDoS.
Implementation Scope
apps/backend/gateway/middleware/rateLimiter.ts(new)Functions to Implement
Retry-Afterheader when exceeded.Tests
Acceptance Criteria
Verification
pnpm testpasses.pnpm buildcompletes.