Building·DevTools·2025

Rate Limiter Library

Token bucket + sliding window in Redis Lua — npm + PyPI dual-publish.

Redis LuaNode.jsPythonFastAPInpm
RoleSolo builderScopeOSS · Algorithm · BackendStatusIn progress · target ship Q3 2026

Overview

A production-ready rate limiter library implementing two core algorithms in Redis Lua scripts (atomic, no race conditions): token bucket for smooth burst control and sliding window for strict per-window limits. Published to npm (for Node/Next.js) and PyPI (for FastAPI/Django). The algorithm is clean and auditable. The artifact is real — published to npm and PyPI, not sitting in a private repo.

Why this matters

Dual-published OSS (npm + PyPI) — signals product thinking, not just feature shipping.

Implementation Highlights

  • Token bucket in Redis Lua — atomic debit with no distributed race conditions
  • Sliding window counter with configurable window size and burst allowance
  • Published to npm (@rahulnainala/rate-limiter) and PyPI for dual-stack use
  • FastAPI middleware + Next.js edge middleware adapters
ShippedIn progress · target ship Q3 2026

Dual-published OSS — npm + PyPI. Token bucket + sliding window in Redis Lua.

Key highlights

  • Token bucket in Redis Lua — atomic debit with no distributed race conditions
  • Sliding window counter with configurable window size and burst allowance
  • Published to npm (@rahulnainala/rate-limiter) and PyPI for dual-stack use
  • FastAPI middleware + Next.js edge middleware adapters

Active development — building this as a production-grade distributed systems reference.

Rahul Nainala — Senior Full-Stack Engineer | Bengaluru