What problem does it solve? Adding authentication to a Next.js application requires coordinating middleware, providers, UI components, and server-side checks, and misconfiguring any layer leaves routes unprotected or breaks static assets. ## Core Features & Use Cases - Middleware Setup: Configure clerkMiddleware with route matchers to separate public and private routes without blocking static files. - Prebuilt UI Components: Use SignInButton, SignUpButton, UserButton, SignedIn, and SignedOut for conditional rendering based on session state. - Server-Side Protection: Validate requests with auth() and currentUser() in API routes, returning 401 for unauthenticated calls. - Use Case: You are building a Next.js SaaS dashboard and need login, signup, and protected API endpoints; follow the three-phase workflow to integrate Clerk, wrap the layout in ClerkProvider, and guard your API routes. ## Quick Start Ask the agent to add Clerk authentication to your Next.js app with middleware protection and a sign-in button in the header.