# Building Distributed Sliding-Window Rate Limiters in TypeScript and Redis

DevFeed: [Building Distributed Sliding-Window Rate Limiters in TypeScript and Redis](<https://devfeed.tech/articles/building-distributed-sliding-window-rate-limiters-in-typescript-and-redis-55537.md>)

Original publisher: [Read original article](<https://www.sitepoint.com/distributed-sliding-window-rate-limiter-typescript-redis/>)

Author: SitePoint Team

Published: 2026-09-20T14:38:55Z

Content type: tutorial

Language: en

Sources: [SitePoint](<https://devfeed.tech/sources/sitepoint.md>)

Topics: [distributed-systems](<https://devfeed.tech/topics/distributed-systems.md>), [rate-limiting](<https://devfeed.tech/topics/rate-limiting.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [TypeScript](<https://devfeed.tech/topics/typescript.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Lua](<https://devfeed.tech/topics/lua.md>), [Express](<https://devfeed.tech/topics/express.md>), [middleware](<https://devfeed.tech/topics/middleware.md>), [k6](<https://devfeed.tech/topics/k6.md>)

Tags: [atomic](<https://devfeed.tech/tags/atomic.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [databases](<https://devfeed.tech/tags/databases.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [express](<https://devfeed.tech/tags/express.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [k6](<https://devfeed.tech/tags/k6.md>), [limit](<https://devfeed.tech/tags/limit.md>), [middleware](<https://devfeed.tech/tags/middleware.md>), [programming](<https://devfeed.tech/tags/programming.md>), [quotas](<https://devfeed.tech/tags/quotas.md>), [race-condition](<https://devfeed.tech/tags/race-condition.md>), [rate-limiting](<https://devfeed.tech/tags/rate-limiting.md>), [redis](<https://devfeed.tech/tags/redis.md>), [typescript](<https://devfeed.tech/tags/typescript.md>)

## AI overview

A practical guide to building a distributed sliding-window rate limiter with TypeScript and Redis. It uses sorted sets and an atomic Lua script to enforce RPM and TPM quotas under concurrency, integrates with Express and Hono middleware, generates rate-limit headers, and tests behavior with k6.

## Source excerpt

Implement an atomic sliding-window rate limiter in TypeScript with Redis sorted sets and Lua, enforcing dual RPM/TPM quotas with standard rate-limit headers. Continue reading Building Distributed Sliding-Window Rate Limiters in TypeScript and Redis on SitePoint.