Universal • Type-safe • Adapter-based

The last rate limiter
you'll ever need

Universal, type-safe, adapter-based rate limiting for every runtime. Build better APIs with confidence.

Universal
Works everywhere
Type-safe
Full IntelliSense
Adapter-based
No vendor lock-in

The Problem

Building rate limiting that works everywhere is hard

Runtime limitations

Most rate limiters only work in one environment

Express rate limiters don't work in edge functions. Cloudflare rate limiters don't work in Node.js. You need different solutions for different environments.

Vendor lock-in

Platform-specific solutions tie you to one vendor

Once you build with a platform-specific rate limiter, you're stuck. Migrating to a different platform means rewriting your rate limiting logic.

Poor developer experience

Most solutions lack proper TypeScript support

Without good types, you spend more time debugging than building. Runtime errors that could be caught at compile time.

The Solution

Why better-ratelimit?

Adapter-based by design

Drop in Redis, LRU, Bun KV, or write your own custom adapter. No vendor lock-in, no assumptions.

Choose the storage backend that fits your infrastructure. From in-memory for development to Redis for production scale.

Works everywhere

Supports Node.js, Bun, Edge runtimes like Cloudflare Workers and Vercel Edge Functions. No hacks required.

Universal runtime support means you can use the same code across different environments without modification.

Precise algorithms

Use sliding window counters, leaky bucket, or token bucket algorithms. Choose performance vs accuracy.

Different algorithms for different use cases. Sliding window for accuracy, fixed window for performance.

Type-safe configuration

Everything is strongly typed from setup to enforcement. Get full IntelliSense in any modern editor.

Full TypeScript support with comprehensive type definitions. Catch errors at compile time, not runtime.

Smart namespacing

Rate limit by user ID, IP, API key, or scoped actions. Compose keys however you want.

Flexible key generation allows you to rate limit by any criteria. Perfect for complex multi-tenant applications.

Minimal footprint

Zero-dependency core. Small bundle. Ideal for cold starts and serverless runtimes.

Tiny bundle size and zero dependencies make it perfect for edge functions and serverless environments.

For Who?

If you're a developer who wants to:

Build rate limiting that works everywhere
Have type-safe configuration with full IntelliSense
Avoid vendor lock-in with adapter-based design

Then better-ratelimit is for you.

Frequently Asked Questions

Everything you need to know about better-ratelimit

Can't find the answer you're looking for? Reach out to our team and we'll get back to you within 24 hours.

Q1Does it support edge runtimes?

Yes. It auto-detects the runtime and adjusts behavior. Fully tested on Cloudflare, Vercel, Deno, and Bun.

Question 1 of 4

Q2Can I use it in client-side apps?

Yes. You can use the in-memory adapter in Electron or browser contexts to rate-limit local actions.

Question 2 of 4

Q3Is it open source?

Yes. MIT licensed. Use it commercially, fork it, contribute back, or run it however you want.

Question 3 of 4

Q4How do I track or visualize usage?

The core does not include analytics by default. You can plug in any logging system, or send events to your preferred monitoring tools.

Question 4 of 4

Ready to get started?

Integrate better-ratelimit in minutes and never worry about abuse again.