JG.RateLimiter 1.0.0

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

dotnet-rate-limiter

NuGet Downloads License CI


High-performance rate limiting for .NET APIs. Supports token bucket, sliding window, fixed window, and concurrency limiting — with per-client and per-endpoint policies, pluggable storage for distributed state, and ASP.NET Core middleware integration.

Features

  • Token Bucket — Smooth rate limiting with configurable burst capacity and refill rate
  • Sliding Window — Accurate request counting over rolling time windows
  • Fixed Window — Simple time-sliced rate limiting with automatic reset
  • Concurrency Limiter — Cap simultaneous in-flight requests per client or endpoint
  • Per-Client Policies — Rate limit by IP, API key, user ID, or custom partition key
  • Per-Endpoint Policies — Different limits for different routes via [RateLimit] / [DisableRateLimiting]
  • Extensible Storage — In-memory by default; implement IRateLimitStore for Redis or other backends
  • Retry-After Headers — Automatic Retry-After and X-RateLimit-* response headers
  • Middleware — Drop-in ASP.NET Core middleware with services.AddRateLimiting()

Installation

dotnet add package JG.RateLimiter

Quick Start

using JG.RateLimiter;
using JG.RateLimiter.Policies;

builder.Services.AddRateLimiting(options =>
{
    options.AddPolicy("api", new TokenBucketPolicy
    {
        PermitLimit = 100,
        Window = TimeSpan.FromMinutes(1),
        BurstLimit = 20,
        PartitionBy = context => context.Connection.RemoteIpAddress?.ToString()
    });
});

app.UseRouting();
app.UseRateLimiting();
app.MapControllers();

Documentation

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Licensed under the Apache License 2.0. See LICENSE for details.


Ready to get started? Install via NuGet and check out the API reference.

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.
  • net8.0

    • No dependencies.

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 44 2/25/2026