Skip to content

Instantly share code, notes, and snippets.

View perkinsjr's full-sized avatar

James P perkinsjr

View GitHub Profile
@perkinsjr
perkinsjr / middleware.ts
Last active January 31, 2024 11:06
Using Clerk with Upstash for Middleware rate limiting and API Protection
import { getAuth, withClerkMiddleware } from "@clerk/nextjs/server";
import { NextResponse, NextFetchEvent } from "next/server";
import type { NextRequest } from "next/server";
import { Ratelimit } from "@upstash/ratelimit";
import { Redis } from "@upstash/redis";
// Add public paths for Clerk to handle.
const publicPaths = ["/", "/sign-in*", "/sign-up*", "/api/blocked"];
// set your rate limit.
@perkinsjr
perkinsjr / devSetup.ps1
Last active April 3, 2019 11:57
Choco install for dev machine and remove some UWPs that no body needs
ECHO Installing apps
ECHO Configure chocolatey
choco feature enable -n allowGlobalConfirmation
# DEV