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" />
<PackageReference Include="JG.RateLimiter" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=JG.RateLimiter&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
dotnet-rate-limiter
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
IRateLimitStorefor Redis or other backends - Retry-After Headers — Automatic
Retry-AfterandX-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
- API Reference — Full API documentation and examples
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 | Versions 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 |