Clerk is the easiest way to add authentication and user management to your Next.js application. Add sign up, sign in, and profile management to your application in minutes.
- Next.js 15.2.8 or later
- React 18 or later
- Node.js
>=20.9.0or later - A Clerk application.
npx -y clerk@latest initcreates or links one and writes its keys to your env file. Agents and new projects get temporary development keys with no Clerk account; in an existing project, a signed-out user is asked to log in unless they pass--accountless. Or create your account and copy the keys from the dashboard.
The fastest way to get started is the Clerk CLI. In an existing Next.js project, run npx -y clerk@latest init. In an empty directory, run npx -y clerk@latest init --framework next --pm npm and it scaffolds the Next.js app as well; there is no lockfile to detect a package manager from, so name one.
Either way it installs @clerk/nextjs, creates or links a Clerk application, writes the keys to your env file, and adds <ClerkProvider>, the middleware, and sign-in and sign-up pages. When an agent runs it, or when you start in an empty directory, no Clerk account is needed: the CLI provisions temporary development keys. In an existing project, a signed-out user is asked to log in, or can pass --accountless to use temporary keys instead.
To set things up by hand instead, follow the Next.js Quickstart.
You'll learn how to install @clerk/nextjs, set up your environment keys, add <ClerkProvider> to your application, use the Clerk middleware, and use Clerk's prebuilt components.
For further information, guides, and examples visit the Next.js reference documentation.
@clerk/nextjs supports upgrading through automatic code migration.
For help, visit our support page.
Join our Discord community to connect with other developers.
We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
@clerk/nextjs follows good practices of security, but 100% security cannot be assured.
@clerk/nextjs is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our security documentation.
This project is licensed under the MIT license.
See LICENSE for more information.