Gathering detailed insights and metrics for nuxt-clerk-utils
Gathering detailed insights and metrics for nuxt-clerk-utils
Gathering detailed insights and metrics for nuxt-clerk-utils
Gathering detailed insights and metrics for nuxt-clerk-utils
npm install nuxt-clerk-utils
Typescript
Module System
Node Version
NPM Version
39.5
Supply Chain
88.5
Quality
82.5
Maintenance
100
Vulnerability
99.3
License
TypeScript (92.44%)
Vue (3.99%)
JavaScript (3.57%)
Total Downloads
1,307
Last Day
1
Last Week
2
Last Month
23
Last Year
1,307
1 Stars
55 Commits
1 Watching
2 Branches
1 Contributors
Latest Version
1.5.13
Package Id
nuxt-clerk-utils@1.5.13
Unpacked Size
17.25 kB
Size
5.75 kB
File Count
40
NPM Version
10.5.0
Node Version
21.7.3
Publised On
03 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-89.5%
2
Compared to previous week
Last month
283.3%
23
Compared to previous month
Last year
0%
1,307
Compared to previous year
Clerk module that builds on top of vue-clerk
This module only works with SSR (server-side rendering) enabled as it uses server API routes. You cannot use this module with nuxt generate
.
nuxt-clerk-utils
1# Using pnpm 2pnpm add -D nuxt-clerk-utils 3 4# Using yarn 5yarn add --dev nuxt-clerk-utils 6 7# Using npm 8npm install --save-dev nuxt-clerk-utils 9
nuxt-clerk-utils
to nuxt.config.ts
1export default defineNuxtConfig({ 2 modules: ["nuxt-clerk-utils"], 3});
The following environment variables are required in order for this module to function correctly to be defined in your .env
:
1NUXT_PUBLIC_CLERK_PUBLISHABLE_KEY=".." 2NUXT_CLERK_SECRET_KEY="..." 3 4# Optional: Enable this if you want to handle clerk webhooks 5NUXT_CLERK_WEBHOOK_SIGNING_SECRET=".."
NOTE: All of the composables and components are re-exported from vue-clerk. See project documentation for usage
The following helpers are auto-imported in your server/
directory.
1// Get the current clerk session if it exists, null otherwise 2const clerkSession = await getClerkSession(event); 3 4// Require a clerk session (send back 401 if no `user` session exists) 5const clerkSession = await requireClerkSession(event);
To work with webhooks, first create the webhook on the clerk dashboard, and define a handler for it in your app like so:
Note: You must provide the
CLERK_WEBHOOK_SIGNING_SECRET
env (see above)
When defining a webhook in this way, you can assume that the webhook is valid as its signature is automatically verified.
1// server/routes/clerk.post.ts 2export default defineClerkWebhook('user.created', ({ payload }) => { 3 console.log('payload', payload) 4}) 5 6
1# Install dependencies 2pnpm install 3 4# Generate type stubs 5pnpm run dev:prepare 6 7# Develop with the playground 8pnpm run dev 9 10# Build the playground 11pnpm run dev:build 12 13# Run ESLint 14pnpm run lint 15 16# Run Vitest 17npm run test 18npm run test:watch 19 20# Release new version 21npm run release
No vulnerabilities found.
No security vulnerabilities found.