Introduction

What is Gr8-Limiter?

Cheaper, Upstash rate limit alternative...

Gr8-Limiter is the easiest way to add a rate limiter to your full stack application. Currently, the SDK is only offered for Typescript/Javascript.

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...