An in-memory limiter that stores recent request timestamps per key and computes allow, remaining, and retry-after decisions.
Read src/demo.ts and run it with any TypeScript runner.# Sliding Window Rate Limiter This limiter keeps recent request timestamps per key and rejects calls once a key has too many hits inside the active window. Production systems usually store this state in Redis or another shared store. The in-memory version makes the algorithm easy to see first. Read in order: 1. `src/limiter.ts` 2. `src/demo.ts` The demo prints numbered steps showing accepted requests, blocked requests, retry timing, and capacity returning as the window moves.