
Extending Better Auth with global Rate Limiting
TL;DR - Install better-auth-rate-limiter , add one plugin call, and every route in your app is rate limited — auth endpoints, AI routes, payment APIs, anything. Memory, database, or Redis backend. Full TypeScript end to end. Your API is open to the internet. Anyone can hammer your /api/generate , /api/checkout , or /api/auth/sign-in endpoints thousands of times per minute - brute-forcing credentials, abusing expensive AI calls, or just making your app crawl. Better Auth handles authentication well, but rate limiting is your problem to solve. And it shouldn't apply only to auth routes - your entire API needs protection. better-auth-rate-limiter is a community plugin that adds flexible, production-ready rate limiting to any route in your app - not just auth endpoints — in a few lines of config. Installation npm install better-auth-rate-limiter # or pnpm add better-auth-rate-limiter Basic Setup Add the plugin to your Better Auth instance: import { betterAuth } from " better-auth " ; impor
Continue reading on Dev.to Webdev
Opens in a new tab

