This is a working integration of SvelteKit, Convex, and Clerk with proper server-side rendering and data fetching.
git clone https://github.com/svelterust/sveltekit-convex-clerk
cd sveltekit-convex-clerk
bun install
bun dev # terminal 1
bun convex dev # terminal 2
After installing dependencies, you need to create a JWT template.
Go to JWT Templates, then select New template.
From the list of templates, select Convex. You'll be redirected to the template's settings page.
Copy and save the Issuer URL as PUBLIC_CLERK_FRONTEND_API_URL
.
Do NOT rename the JWT token. It must be called convex
.
After setting up JWT templates, you need to get these environment variables:
CONVEX_DEPLOYMENT=
PUBLIC_CONVEX_URL=
CLERK_SECRET_KEY=
PUBLIC_CLERK_PUBLISHABLE_KEY=
PUBLIC_CLERK_FRONTEND_API_URL=
CONVEX_DEPLOYMENT
and PUBLIC_CONVEX_URL
come from running bun convex dev
. CLERK_SECRET_KEY
and PUBLIC_CLERK_PUBLISHABLE_KEY
come from creating a Clerk project and getting API keys.
PUBLIC_CLERK_FRONTEND_API_URL
comes from the JWT template you just created.
⭐ Please star and fork this project on GitHub if it helped you get started! ⭐