{"repo":"ciscoheat/sveltekit-rate-limiter","free":true,"listed":false,"github":"https://github.com/ciscoheat/sveltekit-rate-limiter","clone":"git clone https://github.com/ciscoheat/sveltekit-rate-limiter.git","description":"A modular rate limiter for SvelteKit. Use in password resets, account registration, etc.","language":"TypeScript","stars":297,"topics":["rate-limiting","sveltekit","throttle-requests"],"license":"MIT","category":"saas-starters-boilerplates","readme_excerpt":"sveltekit-rate-limiter A modular rate limiter for password resets, account registration, API call limiting, etc. Use in your +page.server.ts , +server.ts or src/hooks.server.ts . Uses an in-memory cache (@isaacs/ttlcache), but can be swapped for something else. Same for limiters, which are plugins. The source file lists both interfaces. Installation How to use Call order for limiters The limiters will be called in smallest unit and rate order, so in the example above: For four consecutive requests from the same source within one minute, the following will happen: Request Cookie IPUA IP ------- --------- ----- ----- 1 Hit 1 Hit 1 Hit 1 2 Hit 2 Hit 2 Hit 2 3 Limit - - 4 Limit - - If the cookie is deleted but the User-Agent stays the same, the counter keeps going for the other limiters: Request Cookie IPUA IP ------- --------- ----- ----- 5 Hit 1 Hit 3 Hit 3 6 Hit 2 Hit 4 Hit 4 7 Limit - - If deleted one more time, the User-Agent limiter will reach its limit: Request Cookie IPUA IP ------- --------- --------- ----- 8 Hit 1 Hit 5 Hit 5 9 Hit 2 Limit - 10 Limit - - Valid units Valid units are, from smallest to largest: Multiple limits You can specify the rates as an array, to handle multiple rates per limiter, like \"Max 1 per second and 100 per hour\": [[1, 's'], [100, 'h']] . Retry-After limiter There is a version of the rate limiter that will return Retry-After information, the number of seconds before the request should be attempted again. This has been implemented in the src/ho","default_branch":null,"files":null,"tree":[],"storefront":"/r/ciscoheat","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ciscoheat/sveltekit-rate-limiter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}