RATE-LIMIT
v0.1.0 — Token-bucket rate limiting for Hyper. In-memory + pluggable stores.
$ hyper add rate-limit
Copies 2 files into src/hyper/rate-limit/ and updates hyper.lock.json.
DEPS
- registry: core
FILES
- rate-limit/index.ts
- rate-limit/sqlite.ts
README
@hyper/rate-limit
Token-bucket rate limiting for Hyper. In-memory + pluggable stores.
Install
Components are installed as source into your repo, not pulled from npm:
bunx hyper add rate-limit
Wires the alias @hyper/rate-limit to src/hyper/rate-limit/ (configurable in hyper.config.json). See hyperjs.ai for the full registry.
Usage
import { Hyper } from "@hyper/core"
import { authRateLimitPlugin, rateLimit } from "@hyper/rate-limit"
export default new Hyper()
.use(rateLimit({ max: 100, windowMs: 60_000 }))
.use(authRateLimitPlugin())
.listen(3000)
Docs
See the main README and docs/ for guides and integration recipes.
License
MIT
MANIFEST
- /r/rate-limit.json — latest
- /r/rate-limit@0.1.0.json — immutable