| name | clerk-prod-checklist |
| description | Production readiness checklist for Clerk deployment.
Use when preparing to deploy, reviewing production configuration,
or auditing Clerk implementation before launch.
Trigger with phrases like "clerk production", "clerk deploy checklist",
"clerk go-live", "clerk launch ready".
|
| allowed-tools | Read, Write, Edit, Grep, Bash(npm:*) |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
Clerk Production Checklist
Overview
Complete checklist to ensure your Clerk integration is production-ready.
Prerequisites
- Clerk integration working in development
- Production environment configured
- Domain and hosting ready
Production Checklist
1. Environment Configuration
API Keys
echo "Publishable key starts with: ${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:0:8}"
Environment Variables
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_...
CLERK_SECRET_KEY=sk_live_...
CLERK_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/onboarding
2. Clerk Dashboard Configuration
Domain Settings
Authentication Settings
OAuth Providers
3. Security Configuration
Middleware
import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server'
const isPublicRoute = createRouteMatcher([
'/',
'/sign-in(.*)',
'/sign-up(.*)',
'/api/webhooks(.*)',
'/api/public(.*)'
])
export default clerkMiddleware(async (auth, request) => {
if (!isPublicRoute(request)) {
await auth.protect()
}
})
Security Headers
4. Webhooks Setup
5. Error Handling
'use client'
export default function Error({ error, reset }: {
error: Error
reset: () => void
}) {
return (
<div>
<h2>Authentication Error</h2>
<p>{error.message}</p>
<button onClick={reset}>Try again</button>
</div>
)
}
6. Performance Optimization
export const config = {
matcher: [
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
'/(api|trpc)(.*)'
]
}
7. Monitoring & Logging
import * as Sentry from '@sentry/nextjs'
export async function POST(request: Request) {
try {
} catch (error) {
Sentry.captureException(error, {
tags: { component: 'clerk-auth' }
})
throw error
}
}
8. Testing
test('user can sign in', async ({ page }) => {
await page.goto('/sign-in')
await page.fill('input[name="email"]', 'test@example.com')
await page.fill('input[name="password"]', 'password123')
await page.click('button[type="submit"]')
await expect(page).toHaveURL('/dashboard')
})
9. Documentation
10. Backup & Recovery
Validation Script
#!/bin/bash
echo "=== Clerk Production Validation ==="
if [[ $NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY != pk_live_* ]]; then
echo "ERROR: Not using production publishable key"
exit 1
fi
if [[ -z "$CLERK_SECRET_KEY" ]]; then
echo "ERROR: CLERK_SECRET_KEY not set"
exit 1
fi
if [[ -z "$CLERK_WEBHOOK_SECRET" ]]; then
echo "WARNING: CLERK_WEBHOOK_SECRET not set"
fi
if [[ ! -f "middleware.ts" ]]; then
echo "WARNING: middleware.ts not found"
fi
echo "=== Validation Complete ==="
Output
- Complete production configuration
- Security hardening applied
- Monitoring configured
- Testing completed
Resources
Next Steps
Proceed to clerk-upgrade-migration for SDK version upgrades.