clerk-observability

Featured

Implement monitoring, logging, and observability for Clerk authentication. Use when setting up monitoring, debugging auth issues in production, or implementing audit logging. Trigger with phrases like "clerk monitoring", "clerk logging", "clerk observability", "clerk metrics", "clerk audit log".

AI & Automation 2,359 stars 334 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Clerk Observability ## Overview Implement monitoring, logging, and observability for Clerk authentication. Covers structured auth logging, middleware performance tracking, webhook event monitoring, Sentry integration, and health check endpoints. ## Prerequisites - Clerk integration working - Monitoring platform (Sentry, DataDog, or Pino logger at minimum) - Logging infrastructure (structured JSON logs recommended) ## Instructions ### Step 1: Structured Authentication Event Logging ```typescript // lib/auth-logger.ts import pino from 'pino' const logger = pino({ level: process.env.LOG_LEVEL || 'info', transport: process.env.NODE_ENV === 'development' ? { target: 'pino-pretty' } : undefined, }) export function logAuthEvent(event: { type: 'sign_in' | 'sign_out' | 'sign_up' | 'permission_denied' | 'session_expired' userId?: string | null orgId?: string | null path: string metadata?: Record<string, any> }) { logger.info({ category: 'auth', ...event, timestamp: new Date().toISOString(), }) } export function logAuthError(error: Error, context: { userId?: string; path: string }) { logger.error({ category: 'auth', error: error.message, stack: error.stack, ...context, timestamp: new Date().toISOString(), }) } ``` ### Step 2: Middleware Performance Monitoring ```typescript // middleware.ts import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server' const isPublicRoute = createRouteMatcher(['/', '/sign-in(.*)...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
8 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category