This example shows how to use Clerk with Fastify.
To run the example locally you need to:
- Sign up for a Clerk account at https://clerk.dev.
- Go to Clerk's dashboard and create an application.
- Clone the repo locally
git clone git@github.com:clerkinc/clerk-fastify-starter.git && cd clerk-fastify-starter
- Set the required Clerk environment variables as shown in the example env file.
npm install
the required dependencies.npm run start
to launch the demo Fastify server.
This example repo contains the following examples:
./src/index.ts
: Basic Clerk and Fastify usage. Run the example withnpm run start
./src/authenticating-specific-routes.ts
: Instead of using Clerk globally, this examples show how to use Clerk for a subset of your routes, using theregister
Fastify helper. Run the example withnpm run start:specific-routes
../src/using-runtime-keys.ts
: Instead of setting environment variables, this examples shows how to initialise Clerk by passing the required API keys directly toclerkPlugin
. Run the example withnpm run start:runtime-keys
To learn more about Clerk and Next.js, check out the following resources:
If you need support or have anything you would like to ask, please reach out in our Discord channel. We'd love to chat!