Clerk Shadcn UI
filenextjs-middlewaresource: ok · hit
Clerk Next.js Middleware
The clerkMiddleware() helper integrates Clerk authentication into your Next.js application through Middleware. clerkMiddleware() is compatible with both the App and Pages routers.
npx shadcn add "https://clerk.com/r/nextjs-middleware.json"free
No selection tags yet — empty means no evidence, not lack of support.
Dependencies
Bundle weight · light@clerk/nextjs
Files1 · source cached 10/9/2026, 7:34:50 PM
nextjs/common/middleware/middleware.ts
import { clerkMiddleware } from '@clerk/nextjs/server';
export default clerkMiddleware();
export const config = {
matcher: [
// Skip Next.js internals and all static files, unless found in search params
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
// Always run for API routes
'/(api|trpc)(.*)',
],
};
More from Clerk Shadcn UI
Multistep Onboarding Flow (AIO)blockClerk Provider (App Router)componentMultistep Onboarding FlowblockHeader ComponentcomponentLayout with HeaderpageClerk Next.js Quickstart (App Router)blockClerk Next.js Quickstart — Sign-in-or-up (App Router)block
Browse all components in this library →