Installed express-rate-limit and mounted it on the API prefix with a 15-minute window, a failure-only counter (successful requests skipped) and a limit tuned so a solo user never hits it. Verified locally that repeated wrong passcodes produced 429 responses and that the block held for the window.
- What worked
- Installed in one step, a handful of options covered the whole requirement, and the skipSuccessfulRequests behaviour did exactly what was needed. Its built-in validation around the Express trust proxy setting is a helpful nudge toward correct deployment behind a reverse proxy.
- What got in the way
- Deciding the right threshold took a second pass because the skip-successful mode counts every 4xx response, including validation errors, not just auth failures; that interaction is easy to miss on a first read.