gofr-dev / gofr-dev/gofr

Allow Configurable Rate-Limit Key Derivation in RateLimiter Middleware

Open
#2,896 5 comments 0 reactions 1 assignee Claimed by @sreenivasivbieb View on GitHub
enhancement Service
Dominant language
Go
Stars
20.9k
Forks
1.8k
Avg merge
5d 18h
Merged PRs (30d)
39

Description

## Problem Statement

The current `RateLimiter` middleware in gofr supports request limiting primarily based on **IP address** (`PerIP` flag).
While this works well for generic APIs, it is **not sufficient for authentication and identity-based use cases** such as:

- Login attempts per **email**
- OTP validation per **user ID**
- Password reset attempts per **account**
- API throttling per **API key / tenant / user**

At the moment, developers cannot easily apply rate limiting on identifiers other than IP without writing custom middleware or duplicating logic.

---

## Current Limitation

```go
RateLimiterConfig{
RequestsPerSecond: 5,
Burst: 10,
PerIP: true,
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.