Hrithik.Security.RateLimiting 1.0.0

dotnet add package Hrithik.Security.RateLimiting --version 1.0.0
                    
NuGet\Install-Package Hrithik.Security.RateLimiting -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hrithik.Security.RateLimiting" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hrithik.Security.RateLimiting" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Hrithik.Security.RateLimiting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hrithik.Security.RateLimiting --version 1.0.0
                    
#r "nuget: Hrithik.Security.RateLimiting, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hrithik.Security.RateLimiting@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hrithik.Security.RateLimiting&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Hrithik.Security.RateLimiting&version=1.0.0
                    
Install as a Cake Tool

🔐 Hrithik.Security.RateLimiting

Enterprise-grade API Rate Limiting for ASP.NET Core

Hrithik.Security.RateLimiting is a lightweight, extensible rate-limiting library designed for banking, fintech, and security-sensitive APIs. It provides API key–based throttling, per-endpoint limits, and pluggable storage with clean middleware integration.

This package is part of the Hrithik.Security ecosystem and is designed to work seamlessly with:

Hrithik.Security.ApiKeyManagement

Hrithik.Security.RequestSigning

Hrithik.Security.ReplayProtection

✨ Features

🚦 API key–based rate limiting

🎯 Per-endpoint and global rate limit rules

🪟 Sliding-window rate limiting algorithm

🧩 Pluggable storage (In-Memory, Redis)

⚙️ ASP.NET Core middleware integration

🔐 Designed for banking & fintech APIs

📦 NuGet-friendly, minimal dependencies

📦 Installation dotnet add package Hrithik.Security.RateLimiting

For distributed environments, install Redis support:

dotnet add package Hrithik.Security.RateLimiting.Redis

🚀 Quick Start 1️⃣ Register Services builder.Services.AddHrithikRateLimiting(options ⇒ { // Global rule options.GlobalRules.Add(new RateLimitRule { Requests = 100, Per = TimeSpan.FromMinutes(1) });

// Per-endpoint rule
options.EndpointRules["POST:/payments"] = new RateLimitRule
{
    Requests = 10,
    Per = TimeSpan.FromSeconds(30)
};

});

2️⃣ Add Middleware app.UseHrithikRateLimiting();

🔑 Rate Limit Identity Resolution

Requests are rate-limited using the following priority:

API Key ID (from Hrithik.Security.ApiKeyManagement)

Signed Client ID (from Hrithik.Security.RequestSigning)

IP Address (fallback)

This ensures accurate and fair throttling in multi-tenant systems.

🧠 How It Works Incoming Request ↓ RateLimitingMiddleware ↓ SlidingWindowLimiter ↓ IRateLimitStore ├── InMemoryRateLimitStore └── RedisRateLimitStore

The middleware is storage-agnostic and can scale from single-instance APIs to distributed, load-balanced systems.

📊 Rate Limit Response

When a limit is exceeded, the API returns:

HTTP 429 – Too Many Requests

Headers:

Retry-After: <seconds>

Response body:

{ "error": "rate_limit_exceeded", "retryAfter": 42 }

🏦 Designed for Fintech & Banking

This package follows security-first design principles:

No hard dependency on ASP.NET Core JSON helpers

Minimal surface area

Deterministic behavior

Predictable throttling semantics

Ideal for:

Payment APIs

Partner integrations

FIX / gateway services

Internal microservices

📌 Target Framework

.NET 6+

.NET 7

.NET 8

(Compatible with netstandard2.0-based consumers)

📄 License

MIT License

👤 Author

Hrithik Kalra

📧 Email: hrithikkalra11@gmail.com

☕ Buy me a coffee: https://www.buymeacoffee.com/alkylhalid9 or consider supporting its development: 👉 https://github.com/sponsors/hrithikalra

🔗 Related Packages

Hrithik.Security.ApiKeyManagement

Hrithik.Security.RequestSigning

Hrithik.Security.ReplayProtection

Hrithik.Security.Idempotency (coming soon)

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 129 2/1/2026