Clerk Next.js SDK
Clerk makes it simple to add authentication to your Next.js application. This reference lists the features and methods available in Clerk's Next.js SDK.
Client-side helpers
Because the Next.js SDK is built on top of the Clerk React SDK, you can utilize the hooks that the React SDK provides. These hooks give you access to the Clerk
object and a set of useful helper methods for signing in and signing up. Learn more about these hooks in the React SDK reference.
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.
Other references
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
To see an example of Clerk's features, such as user and organization management, integrated in a single application, explore the Clerk + Next.js demo repositories:
Feedback
Last updated on