Documentation Index
Fetch the complete documentation index at: https://docs.pyqdeck.in/llms.txt
Use this file to discover all available pages before exploring further.
Overview
PyqDeck uses Clerk for authentication, with custom branding on the frontend and Svix webhooks for user synchronization on the backend.Frontend Auth
Clerk Provider
The app is wrapped withClerkProvider in the root layout:
Auth Pages
Custom sign-in and sign-up pages using Clerk’s components:Getting the Token for API Calls
TheuseApi() hook handles token injection automatically:
Backend Auth
Middleware Verification
The backend uses@clerk/express to verify JWT tokens on protected routes:
Getting User ID
AfterrequireAuth(), the user ID is available on the request:
Webhook Synchronization
Clerk sends webhooks for user events (creation, updates, deletion). The backend processes these via Svix:Webhook Endpoint
Local Development
For local webhook testing, use the Clerk CLI:Auth Flow Details
Custom Branding
Clerk’s UI is customized to match PyqDeck’s brand:- Colors: Primary blue (
#3B82F6) - Fonts: Matching the app’s typography
- Logo: PyqDeck logo on auth pages
OTP Verification
For phone/email verification, Clerk handles the OTP flow:- User enters phone/email
- Clerk sends OTP code
- User enters code on verification page
- Clerk verifies and returns JWT
Session Management
- JWT tokens are automatically managed by Clerk
- Token refresh happens automatically via
getToken() - Session expiry is configured in Clerk dashboard
Environment Variables
| Variable | Frontend | Backend |
|---|---|---|
CLERK_PUBLISHABLE_KEY | NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | CLERK_PUBLISHABLE_KEY |
CLERK_SECRET_KEY | - | CLERK_SECRET_KEY |
CLERK_WEBHOOK_SECRET | - | CLERK_WEBHOOK_SECRET |
Security Considerations
- Never expose
CLERK_SECRET_KEY- Only used server-side - Verify webhooks with Svix - Prevents forged webhook events
- Protect API routes with
requireAuth()- Ensures only authenticated users can access protected endpoints - Rate limiting - Auth-related endpoints are rate-limited
Next Steps
- Explore the monorepo architecture
- Learn about the SDK flow
- Review testing standards

