Skip to main content
Docs

Clerk Fastify SDK

The Clerk Fastify SDK provides a powerful set of tools and utilities to seamlessly integrate authentication, user management, and Organization management into your Fastify application. Refer to the quickstart guideFastify Icon to get started.

clerkPlugin()

The clerkPlugin() function is required to integrate Clerk's authentication into your application. The function checks request cookies and headers for a session JWT. If valid, it attaches the Auth object to the request object under the auth key. See the reference docFastify Icon for more information.

getAuth()

The getAuth() helper retrieves the current user's authentication state from the request object. It returns the Auth object, which includes helpful authentication information like the user's ID, session ID, and Organization ID. It's also useful for protecting routes. See the reference docFastify Icon for more information.

clerkClient

clerkClient is a wrapper around the Backend API that makes it easier to interact with the API. For example, to retrieve a list of all users in your application, you can use the users.getUserList() method instead of manually making a fetch request to the https://api.clerk.com/v1/users endpoint.

To access a resource, you must first instantiate a clerkClient instance. See the reference documentation for more information.

Feedback

What did you think of this content?

Last updated on