Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
553643a
docs(nextjs): Surface clerk init in exported doc comments
shane-kercheval Sep 4, 2026
d9a2014
docs(nextjs): Link the CLI docs instead of a bare URL
shane-kercheval Sep 4, 2026
487fcca
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 4, 2026
4895b22
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 4, 2026
0d44f5c
docs(nextjs): Correct the env file, npx flag and account claim
shane-kercheval Sep 4, 2026
42746de
Merge remote-tracking branch 'origin/docs/nextjs-cli-hint-in-types' i…
shane-kercheval Sep 4, 2026
c90a62c
docs review
SarahSoutoul Sep 7, 2026
28bd7aa
docs(nextjs): Restore original CLI command
SarahSoutoul Sep 7, 2026
84315fd
docs(nextjs): Name the package manager and fix the quickstart link
shane-kercheval Sep 8, 2026
ad35b8f
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 8, 2026
6329361
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 8, 2026
cd920a8
Update .changeset/nextjs-cli-hint-in-types.md
shane-kercheval Sep 9, 2026
4c65b97
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 9, 2026
e79efd9
docs(nextjs): Scope the no-account claim to agents and new projects
shane-kercheval Sep 9, 2026
00a3829
Merge remote-tracking branch 'origin/docs/nextjs-cli-hint-in-types' i…
shane-kercheval Sep 9, 2026
961041c
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 9, 2026
9f3821c
Merge branch 'main' into docs/nextjs-cli-hint-in-types
shane-kercheval Sep 9, 2026
4808d12
docs(nextjs): Correct the env file the accountless CLI path writes
manovotny Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nextjs-cli-hint-in-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/nextjs': patch
---

Add a note to the `ClerkProvider`, `clerkMiddleware()` and `auth()` doc comments explaining that `npx clerk@latest init` can provision temporary development keys without a Clerk account. Update the README prerequisites and installation section to say the same, replacing the statement that an existing Clerk application and account are required.
8 changes: 6 additions & 2 deletions packages/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@
- Next.js 15.2.8 or later
- React 18 or later
- Node.js `>=20.9.0` or later
- An existing Clerk application. [Create your account for free](https://dashboard.clerk.com/sign-up?utm_source=github&utm_medium=clerk_nextjs).
- A Clerk application. `npx -y clerk@latest init` creates 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](https://dashboard.clerk.com/sign-up?utm_source=github&utm_medium=clerk_nextjs) and copy the keys from the dashboard.

### Installation

The fastest way to get started with Clerk is by following the [Next.js Quickstart](https://clerk.com/docs/quickstarts/nextjs?utm_source=github&utm_medium=clerk_nextjs).
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](https://clerk.com/docs/nextjs/getting-started/quickstart?utm_source=github&utm_medium=clerk_nextjs).

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.

Expand Down
4 changes: 4 additions & 0 deletions packages/nextjs/src/app-router/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export type AuthFn = GetAuthFnNoRequest<SessionAuthWithRedirect, true> & {
* - Only available for App Router.
* - Only works on the server-side, such as in Server Components, Route Handlers, and Server Actions.
* - Requires [`clerkMiddleware()`](https://clerk.com/docs/reference/nextjs/clerk-middleware) to be configured.
*
* To set up Clerk in your project, run `npx -y clerk@latest init` from your project's root directory.
* The Clerk CLI can provision temporary development keys without a Clerk account and write them to `.env.local`. See
* the [Clerk CLI docs](https://clerk.com/docs/cli).
*/
export const auth: AuthFn = (async (options?: AuthOptions) => {
// eslint-disable-next-line @typescript-eslint/no-require-imports
Expand Down
5 changes: 5 additions & 0 deletions packages/nextjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ import * as ComponentsModule from '#components';

import type { ServerComponentsServerModuleTypes } from './components.server';

/**
* To set up Clerk in your project, run `npx -y clerk@latest init` from your project's root directory.
* The Clerk CLI can provision temporary development keys without a Clerk account and write them to `.env.local`. See
* the [Clerk CLI docs](https://clerk.com/docs/cli).
*/
export const ClerkProvider = ComponentsModule.ClerkProvider as ServerComponentsServerModuleTypes['ClerkProvider'];
export const Show = ComponentsModule.Show as ServerComponentsServerModuleTypes['Show'];

Expand Down
4 changes: 4 additions & 0 deletions packages/nextjs/src/server/clerkMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ interface ClerkMiddleware {

/**
* The `clerkMiddleware()` helper integrates Clerk authentication into your Next.js application through Middleware. `clerkMiddleware()` is compatible with both the App and Pages routers.
*
* To set up Clerk in your project, run `npx -y clerk@latest init` from your project's root directory.
* The Clerk CLI can provision temporary development keys without a Clerk account and write them to `.env.local`. See
* the [Clerk CLI docs](https://clerk.com/docs/cli).
*/
export const clerkMiddleware = ((...args: unknown[]): NextMiddleware | NextMiddlewareReturn => {
const [request, event] = parseRequestAndEvent(args);
Expand Down
Loading