ImanSoftware.RateLimiter
1.0.5
dotnet add package ImanSoftware.RateLimiter --version 1.0.5
NuGet\Install-Package ImanSoftware.RateLimiter -Version 1.0.5
<PackageReference Include="ImanSoftware.RateLimiter" Version="1.0.5" />
<PackageVersion Include="ImanSoftware.RateLimiter" Version="1.0.5" />
<PackageReference Include="ImanSoftware.RateLimiter" />
paket add ImanSoftware.RateLimiter --version 1.0.5
#r "nuget: ImanSoftware.RateLimiter, 1.0.5"
#:package ImanSoftware.RateLimiter@1.0.5
#addin nuget:?package=ImanSoftware.RateLimiter&version=1.0.5
#tool nuget:?package=ImanSoftware.RateLimiter&version=1.0.5
🚦 ImanSoftware.RateLimiter
Version: 1.0.3 | Last Updated: August 2026
A lightweight rate limiting library for ASP.NET Core applications.
📖 Table of Contents
- Introduction
- Features
- Installation
- Usage
- Custom Strategy
- Supported Strategies
- Storage
- ASP.NET Core Middleware
- Configuration
- License
🎯 Introduction
ImanSoftware.RateLimiter is a lightweight rate limiting library for ASP.NET Core applications.
It provides configurable rate limiting policies and supports multiple rate limiting strategies through ASP.NET Core middleware.
✨ Features
- ✅ Fixed Window strategy
- ✅ Sliding Window strategy
- ✅ Token Bucket strategy
- ✅ In-memory storage
- 🚧 Redis support — coming soon
- ✅ ASP.NET Core middleware
- ✅ Highly configurable policies
- ✅ Extensible strategies
📦 Installation
Install the package via NuGet Package Manager:
dotnet add package ImanSoftware.RateLimiter
🚀 Usage
Configure Rate Limiting
Register the rate limiter in Program.cs:
builder.Services.AddRateLimiter(options =>
{
options.DefaultStrategy = "FixedWindow";
options.DefaultPolicy = new RateLimitPolicy
{
Limit = 100,
WindowSeconds = 60
};
options.Policies["api"] = new RateLimitPolicy
{
Limit = 50,
WindowSeconds = 10
};
});
Then enable the middleware:
app.UseRateLimiter();
🧩 Custom Strategy
The library is extensible and allows custom rate limiting strategies to be registered.
builder.Services.AddRateLimiter(
configureOptions: options =>
{
// Configure options...
},
customRegistration: services =>
{
services.TryAddSingleton<IRateLimiterStrategy, TokenBucketStrategy>();
}
);
This allows applications to provide their own strategy implementation or customize strategy registration through dependency injection.
🔧 Supported Strategies
The package currently supports:
| Strategy | Status |
|---|---|
| Fixed Window | ✅ Supported |
| Sliding Window | ✅ Supported |
| Token Bucket | ✅ Supported |
Fixed Window
Limits requests within fixed time windows.
Sliding Window
Provides rate limiting based on a rolling time window.
Token Bucket
Uses a token-based mechanism to control request rates.
💾 Storage
The current implementation uses in-memory storage.
Redis-based storage is planned for a future release.
🌐 ASP.NET Core Middleware
The library includes middleware for applying rate limiting to ASP.NET Core applications.
Enable it with:
app.UseRateLimiter();
The middleware works with the configured rate limiting policies and strategies.
⚙️ Configuration
A default strategy and default policy can be configured:
options.DefaultStrategy = "FixedWindow";
options.DefaultPolicy = new RateLimitPolicy
{
Limit = 100,
WindowSeconds = 60
};
Additional named policies can be configured:
options.Policies["api"] = new RateLimitPolicy
{
Limit = 50,
WindowSeconds = 10
};
This allows different parts of an application to use different rate limiting policies.
Design Goals
- Clean abstraction
- Dependency Injection friendly
- High performance
- Structured logging support
- Scope support
- Easy to mock
- Framework independent
- Clean Architecture compatible
- Minimal API
Requirements
- .NET Standard 2.0+
- .NET 6+
- .NET 7+
- .NET 8+
- .NET 9+
- .NET 10.0+
Author
Iman Estiri
📧 contact.imanestiri@gmail.com
📧 dev.imanestiri@gmail.com
GitHub:
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- ImanSoftware.Extensions (>= 1.0.3)
- ImanSoftware.Logging (>= 1.0.1)
- ImanSoftware.OutCome (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.