Preview & Production – Taking Auth Live
You built and tested auth on your branch's preview. Now you'll ship it: get a real domain, switch Clerk to its production keys, merge to main, and verify everything works for real users.
You're on your auth branch, auth works on the Vercel preview, and your data is isolated per user. This lesson is the production cutover.
1. How the environments fit together
- Preview – the live URL Vercel built for your branch. You tested auth here.
- Production – your real site on your custom domain, updated when you merge to
main.
A couple of things differ between them:
- Database (Neon): one database across environments – that's fine, because your server scopes every query to the logged-in user.
- Auth (Clerk): Clerk has a development instance (test keys, allows
*.vercel.appand localhost – what you've used so far) and a production instance (live keys, requires a real custom domain). That's why you need a domain before going live.
Outcome: You understand the preview → production flow and why Clerk needs a custom domain.
2. Get a custom domain
Clerk production needs a real domain (not *.vercel.app). Buying it through Vercel is simplest – DNS and SSL are handled for you.
- Go to vercel.com/domains, find an available domain, and purchase it.
- In your Vercel project: Settings → Domains → Add, enter your domain, set it as Production.
- Wait a couple of minutes and confirm
https://yourdomain.comloads with SSL.
(Already own a domain elsewhere? You can add it and point its DNS to Vercel instead.)
Outcome: You have a custom domain linked to your project.
3. Switch Clerk to production
Now set up Clerk's production instance for your domain, and let Claude store the live keys in the Vercel vault.
Production uses Clerk's live keys (pk_live_…); preview/dev keep the test keys (pk_test_…). That keeps real users separate from your test accounts – and it's why the keys are set per environment in Vercel.
Outcome: Clerk production is configured for your domain, with live keys in Vercel.
4. Merge to main and deploy
Auth is tested on the preview and production is configured – time to merge your branch to main, which deploys to your live domain.
Outcome: Your auth is merged to main and deployed to your live domain.
5. Verify it works in production
Run the real flow on your live domain.
Outcome: Authentication works for real users on your production domain.