@yasui/rate-limit
v1.1.0
Published
Rate limiting middleware for YasuiJS
Downloads
142
Maintainers
Readme
@yasui/rate-limit
Production-ready rate limiting middleware for YasuiJS
Features
- ✅ Configurable request limits per time window
- ✅ In-memory store (extensible for Redis, etc.)
- ✅ Custom key generation (IP, API key, user ID)
- ✅ Standard rate limit headers (RFC 6585)
- ✅ Automatic cleanup of expired entries
- ✅ Skip logic for whitelisting
Installation
npm install @yasui/rate-limitQuick Start
import yasui from 'yasui';
import { rateLimit } from '@yasui/rate-limit';
yasui.createServer({
middlewares: [
rateLimit({
max: 100, // 100 requests
windowMs: 60000 // per minute
})
],
controllers: [UserController]
});📖 Documentation
License
This project is licensed under the GNU Affero General Public License v3.0 or later. See the LICENSE file for details.
