Skip to content

Implement comprehensive API rate limiting with configurable tiers and Redis persistence #894

Description

@nanaf6203-bit

Problem

The RateLimitGuard and RateLimitService have gaps: user tiers default to free with no way to configure different limits, JWT payload doesn't include a tier field, IP-based rate limiting uses in-memory storage only (no Redis), GraphQL endpoints not rate-limited.

Why It Matters

Without effective rate limiting, API endpoints are vulnerable to abuse and DoS attacks.

Expected Outcome

Configurable, persistent, tier-based rate limiting that survives restarts.

Acceptance Criteria

  • User tiers (free, pro, enterprise) with configurable limits
  • Tier field added to JWT payload and AuthUserPayload type
  • Redis-backed rate limit counters
  • Rate limit headers consistently set
  • GraphQL rate limiting (complexity-based)

Files Affected

src/auth/rate-limit.service.ts, src/auth/rate-limit.config.ts, src/auth/guards/rate-limit.guard.ts, src/auth/types/auth-user.type.ts

Difficulty

Medium

Estimated Effort

Medium (1 week)

Labels

rate-limiting, security, enhancement

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions