Tiered rate limiting middleware for Express using memory store; separate limits for auth, uploads, writes, reads, and generic API calls, ideal for single‑instance dev tools.
// Source: https://github.com/BradGroux/veritas-kanban | License: MIT | Copyright 2026 Digital Meld
// Provided via justclaw.it.com; keep this notice with the code.
import expressRateLimit from 'express-rate-limit';
import type { Request } from 'express';
/**
* Rate limiting middleware using express-rate-limit.
*
* Uses the built-in MemoryStore which:
* - Automatically cleans up expired entries (no memory leaks)
* - Uses a precise sliding window counter algorithm
* - Is the right choice for a single-instance local dev tool
*
* State resets on server restart, which is acceptable for this use case.
* If persistence is ever needed, swap MemoryStore for a file or Redis store.
*
* Tiered rate limits:
* - authRateLimit — 10 req / 15 min (login, token refresh)
* - uploadRateL
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key