...

Securing APIs: Express rate limit and slow down | MDN Blog

Securing APIs: Express rate limit and slow down | MDN Blog

Rate limiting and slow-down mechanisms help maintain the stability, security, and performance of web applications.
These controls prevent overloading systems and offer a level of protection against brute force and Distributed Denial of Service (DDoS) attacks.
Rate limiting also improves the scalability of your application and enhances user experience by maintaining service quality and reliability.

Content delivery networks (CDNs) and network-level solutions are popular and convenient ways to secure projects from these problems, but you can also implement controls and slow-down logic directly in your applications.
This approach gives you more control of your server’s behavior and provides an additional fallback if a CDN or a DDoS protection fails.
Additionally, scripts or app integrations that are not malicious can misbehave because of bugs or network issues.
Rate limiting and slow-down mechanisms can stop programs from performing actions excessively and unintentionally using system or network resources.

In this article, we will create an Express application and incorporate rate limit and slow-down logic to make it more scalable and secure.
There are many aspects to securing an application, but by using the methods described in this post, you should be comfortable with configuring one additional means of ensuring your Express apps are more resilient and secure.