Skip to main content
Docs

Clerk Next.js SDK

The Clerk Next.js SDK gives you access to prebuilt components, React hooks, and helpers to make user authentication easier. Refer to the quickstart guide to get started.

Client-side helpers

Because the Next.js SDK is built on top of the Clerk React SDK, you can use the hooks that the React SDK provides. These hooks include access to the Clerk object, User object, Organization object, and a set of useful helper methods for signing in and signing up.

Server-side helpers

App router

Clerk provides first-class support for the Next.js App Router. The following references show how to integrate Clerk features into apps using the latest App Router and React Server Components features.

Pages router

Clerk continues to provide drop-in support for the Next.js Pages Router. In addition to the main Clerk integration, the following references are available for apps using Pages Router.

Auth object

Both auth() (App Router) and getAuth() (Pages Router) return an Auth object. This JavaScript object contains important information like the current user's session ID, user ID, and organization ID. Learn more about the Auth object.

clerkMiddleware()

The clerkMiddleware() helper integrates Clerk authentication into your Next.js application through middleware. It allows you to integrate authorization into both the client and server of your application. You can learn more here.

Demo repositories

For examples of Clerk's features, such as user and organization management, integrated into a single application, see the Next.js demo repositories:

Feedback

What did you think of this content?

Last updated on