auth identity⏱10 minutes
Get Started with Clerk
UnverifiedQuick Summary
“The most comprehensive user management platform”
Best for: Next.js and React developers who need auth, user management, and organization features with minimal setup
Time to first integration: 10 minutes
📋Prerequisites
- ✓Node.js 18+ installed
- ✓A Clerk account — sign up here
- ✓An existing project (Next.js, React, or Node.js recommended)
Setup Steps
4 steps1
1
Install
Add the Clerk SDK to your Next.js project.
bash
npm install @clerk/nextjs2
2
Add API keys
Add your publishable and secret keys to .env.local (from the Clerk dashboard).
bash
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_...
CLERK_SECRET_KEY=sk_...3
3
Add middleware
Create middleware.ts to protect routes with Clerk.
typescript
import { clerkMiddleware } from '@clerk/nextjs/server'
export default clerkMiddleware()
export const config = {
matcher: ['/((?!_next|.*\\..*).*)', '/(api|trpc)(.*)'],
}4
4
Wrap your app
Wrap the root layout in <ClerkProvider> and drop in <SignInButton>/<UserButton>.
tsx
import { ClerkProvider } from '@clerk/nextjs'
export default function RootLayout({ children }) {
return (
<ClerkProvider>
<html lang="en"><body>{children}</body></html>
</ClerkProvider>
)
}Related Guides
Setting up a full stack? Check out these complementary guides.