Set up Clerk
Clerk handles sign-in for XLR8. It shows the sign-in form and gives the app a token that the Convex backend checks. At the end of this page you have three values: the publishable key, the Frontend API URL and your user id.
Production or development instance
Section titled “Production or development instance”A Clerk application starts with a development instance; you add a production instance when you need it.
- Production is what you want for real use. It needs a domain you control: Clerk serves its
Frontend API from
clerk.<your domain>, for examplehttps://clerk.xlr8.example.com. Its publishable key starts withpk_live_. - Development is fine to try XLR8 out. It needs no domain, its publishable key starts with
pk_test_, and its Frontend API URL looks likehttps://<slug>.clerk.accounts.dev. Clerk shows a development badge, and the instance is meant for testing only.
The steps below use a production instance. Clerk renames its dashboard menus now and then; if a label differs, look for the closest match.
Set up the application
Section titled “Set up the application”-
Create the application. In the Clerk dashboard, create an application and switch to (or create) its Production instance. Add your domain (
xlr8.example.com) and create the DNS records Clerk shows you. They can take a while to become active.Optional: upload
app/public/brand/clerk-logo.pngfrom the repository as the application logo. -
Create the JWT template. Go to Configure → JWT templates → New template and pick Convex. Keep the name
convex. The app asks Clerk for a token from the template calledconvex, and the backend expects the audienceconvex. With another name, sign-in fails. -
Note the publishable key and the Frontend API URL. You find them under Configure → API keys and Domains:
- the publishable key (
pk_live_…) goes intoclerkPublishableKeyin your instance settings; - the Frontend API URL (
https://clerk.xlr8.example.com) becomesCLERK_JWT_ISSUER_DOMAINon the Convex backend.
- the publishable key (
-
Create your user. Go to Users → Create user, or sign up once before you restrict sign-ups in the next step. Open the user’s page and copy the user id (
user_…). You need it forXLR8_OWNER_IDS. -
Restrict sign-ups. Go to Configure → Restrictions → Sign-up mode and choose Restricted. Only the accounts in
XLR8_OWNER_IDSget into XLR8 anyway; this keeps strangers from creating Clerk accounts at all. -
Point Clerk’s links to your app. Go to Configure → Developers → Paths:
<SignIn />: “Sign-in page on application domain” →https://xlr8.example.com/sign-in- Signing out: “Page on application domain” →
https://xlr8.example.com/ - Leave
<SignUp />as it is, and save.
The publishable key is not a secret: it ends up in the browser. Clerk’s secret keys are not needed anywhere in XLR8.
XLR8 uses no paid Clerk feature. On a free plan, the sign-in form shows a “Secured by Clerk” badge, which only paid plans can remove.
Next step
Section titled “Next step”Continue with Convex. There you put the Frontend API URL and your user id into the backend’s environment variables.