Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Official starter repo for Clerk and Next.js
Clerk Next.js Starter is an official boilerplate template from Clerk that shows how to add sign-up, sign-in, profile management, and an authenticated API route to a Next.js application.
The Clerk Next.js Starter is an official sample app published by Clerk, the authentication service. It takes a plain Next.js project and wires in Clerk's prebuilt authentication components, middleware, and environment configuration. The output is a working Next.js application where users can register, log in, edit their profile, and call a protected API endpoint. The codebase is designed to run anywhere Next.js runs and includes a one-click Deploy with Vercel button.
npx create-next-app --example https://github.com/clerkinc/clerk-nextjs-starter or the equivalent Yarn command..env.local.sample file lists the Clerk keys you need to set before running locally.After creating a Clerk account and application in the Clerk dashboard, you copy the example environment file, install dependencies with npm, and run npm run dev. The pages use Clerk's React components, and the API route reads the session via Clerk's middleware. A hosted demo is available at clerk-nextjs-example.vercel.app.
NextAuth.js is an open-source authentication library for Next.js that stores sessions in your own database. Auth0 offers a hosted identity platform with a Next.js SDK, following a similar hosted model to Clerk. Each has a different setup and pricing model, so the right choice depends on whether you want to manage sessions and infrastructure yourself.
Yes. The README instructs you to sign up for a Clerk account at clerk.dev and create an application in the dashboard before setting the environment variables and running the project.
Yes. The README includes a Deploy with Vercel button that lets you deploy the example directly from the GitHub repository through Vercel.
Run npx create-next-app --example https://github.com/clerkinc/clerk-nextjs-starter, install dependencies with npm install, set the Clerk environment variables from .env.local.sample, then launch the server with npm run dev.
