
Template details
Clerk Next.js Starter
Official starter repo for Clerk and Next.js
About this template
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.
What is the Clerk Next.js Starter?
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.
Key Features
- Prebuilt auth pages — The template includes sign-up and sign-in screens powered by Clerk's hosted UI, with profile management built in.
- Authenticated API route — A server-side API route demonstrates how to require a logged-in user and read the session.
- Vercel deployment — A Deploy with Vercel button appears in the README so you can launch the app directly from the GitHub repository.
- create-next-app bootstrap — You can generate a local copy with
npx create-next-app --example https://github.com/clerkinc/clerk-nextjs-starteror the equivalent Yarn command. - Environment variable template — A
.env.local.samplefile lists the Clerk keys you need to set before running locally. - Official quickstart — Clerk publishes a "Get started with Next.js and Clerk" guide linked from the README that walks through the same integration.
Who is it for?
- Next.js developers starting a new project — They can copy the starter instead of integrating auth from scratch, saving time on boilerplate.
- Teams adopting a hosted auth provider — The template already wires up Clerk's dashboard, user management, and prebuilt widgets, so they can focus on business logic.
- Developers deploying to Vercel — The repo includes a deployment button that provisions Clerk and Next.js together on Vercel without manual configuration.
How does it work?
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.
Alternatives
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.
FAQ
Do I need a Clerk account to use this starter?
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.
Can I deploy this starter to Vercel?
Yes. The README includes a Deploy with Vercel button that lets you deploy the example directly from the GitHub repository through Vercel.
How do I run the starter locally?
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.















