ImanSoftware.RateLimiter 1.0.5

dotnet add package ImanSoftware.RateLimiter --version 1.0.5
                    
NuGet\Install-Package ImanSoftware.RateLimiter -Version 1.0.5
                    
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="ImanSoftware.RateLimiter" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ImanSoftware.RateLimiter" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="ImanSoftware.RateLimiter" />
                    
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 ImanSoftware.RateLimiter --version 1.0.5
                    
#r "nuget: ImanSoftware.RateLimiter, 1.0.5"
                    
#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 ImanSoftware.RateLimiter@1.0.5
                    
#: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=ImanSoftware.RateLimiter&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=ImanSoftware.RateLimiter&version=1.0.5
                    
Install as a Cake Tool

🚦 ImanSoftware.RateLimiter

Version: 1.0.3 | Last Updated: August 2026

A lightweight rate limiting library for ASP.NET Core applications.


📖 Table of Contents


🎯 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:

https://github.com/ImanEstiri


License

This project is licensed under the MIT License.

Product 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. 
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.5 89 9/9/2026
1.0.4 98 9/9/2026
1.0.3 106 8/9/2026
1.0.2 104 8/9/2026
1.0.1 102 8/9/2026
1.0.0 102 8/9/2026