/gr8-limiter

Monorepo of Rate Limiting Service

Primary LanguageTypeScript

Gr8 Limiter

Throw in your next.js project for rate limiting...

🔗Home | 📝Docs | 🛠️Design

A drop in rate limiter designed for web frameworks like next.js. Focus on shipping code and Gr8 limiter will handle rate limiting with limited to no set up.

How to use?

All the code you need:

route.ts

const client = new Client({
  // this will be cleaned up soon...
  apiKey: process.env.STRATUS_TOKEN!,
  apiURL: "https://gr8-limit-docker.onrender.com/api/v1/ratelimit",
});

export async function POST(req: Next Request){
// Inside a route method
  try {
    const rateLimited = await client.rateLimit();
    if (rateLimited) {
      return NextResponse.json(
        { error: "Rate limited." },
        { status: 429 }
      );
    }
    // Rest of ur code...

Stack:

go typescript nextjs postgresql redis tailwind