Skip to content

cruzluna/gr8-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gr8 Limiter

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

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

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages