Deploying to Production
This guide provides step-by-step instructions for deploying your Kaizen application to production using Vercel and transitioning all services from development to production environments.You’ll need a custom domain for production deployment. Services like Clerk and Polar require verified domains for production environments. Purchase a domain from providers like Namecheap, Porkbun, or GoDaddy before proceeding.
Prerequisites
- ✅ A custom domain (purchased and ready)
- ✅ Your code committed and pushed to GitHub/GitLab/Bitbucket
- ✅ All development features working locally
- ✅ Production accounts for your enabled services
Step 1: Configure Production Services
Clerk Authentication
For Email/Password Only (Simplest):- In your existing Clerk application, go to Configure → Instance Settings
- Switch from “Development” to “Production” mode
- Update your domain settings:
- Add your production domain (e.g.,
https://yourdomain.com
) - Remove localhost URLs
- Add your production domain (e.g.,
- Copy your new production API keys:
VITE_CLERK_PUBLISHABLE_KEY
(starts withpk_live_
)CLERK_SECRET_KEY
(starts withsk_live_
)
- Follow the Clerk OAuth setup guide for each provider
- Update OAuth callback URLs to your production domain
- For Google OAuth specifically:
- Update “Authorized JavaScript origins” to your production domain
- Update “Authorized redirect URIs” to use your production Clerk instance
- Ensure your Google OAuth app is set to “In production” status (not “Testing”)
Polar.sh Payments
-
Switch to production Polar:
- Log out of
sandbox.polar.sh
- Log into
polar.sh
(production) - Create your production organization
- Set up your subscription plans with real pricing
- Log out of
-
Get production API keys:
- Go to Settings → API Keys
- Copy your
POLAR_ACCESS_TOKEN
(starts withpolar_
) - Copy your
POLAR_ORGANIZATION_ID
(starts withorg_
)
Resend Email Service
-
Create production API key:
- In Resend dashboard, go to API Keys
- Create new key with “Full Access”
- Copy the API key (starts with
re_
)
-
Set up custom domain (Recommended):
- Go to Domains → Add Domain
- Enter your domain (e.g.,
yourdomain.com
) - Add the required DNS records to your domain registrar
- Wait for verification (can take up to 24 hours)
- Use
noreply@yourdomain.com
as your sender email
OpenAI (If Enabled)
- Use existing API key or create a new production key
- Ensure sufficient credits for production usage
Step 2: Set Up Convex Production Environment
Add Environment Variables to Convex Production
- Go to your Convex Dashboard → Switch to Production environment
- Navigate to Settings → Environment Variables
- Add the following variables:
Webhook secrets will be generated in Step 5 when you configure webhooks. Add placeholders for now.
Step 3: Deploy Backend to Convex Production
Now that your production environment variables are configured, deploy your Convex backend:-
Deploy your Convex backend to production:
-
Note your production deployment URL (e.g.,
https://posh-cassowary-60.convex.cloud
) -
Configure Convex for Vercel deployment (one-time setup):
Convex will now deploy successfully since all required environment variables are configured.
Step 4: Deploy Frontend to Vercel
-
Connect your repository to Vercel:
- Go to vercel.com and create new project
- Import your Git repository
- Select your framework preset as Vite
-
Configure build settings:
- Build Command:
npm run build
- Output Directory:
dist
- Install Command:
npm install --legacy-peer-deps
- Build Command:
-
Add environment variables in Vercel:
Required for all deployments:
- Deploy the project - Vercel will automatically deploy
-
Set up custom domain:
- In Vercel dashboard, go to Settings → Domains
- Add your custom domain
- Follow DNS setup instructions
Step 5: Configure Production Webhooks
Polar.sh Webhooks
-
In Polar dashboard:
- Go to Settings → Webhooks
- Click Add Endpoint
- URL:
https://your-project.convex.cloud/payments/webhook
- Format: Raw
- Events: Select all events
- Click Generate new secret and copy it
-
Update Convex environment variable:
- Add
POLAR_WEBHOOK_SECRET=whsec_...
to your Convex production environment
- Add
Resend Webhooks
-
In Resend dashboard:
- Go to Webhooks → Add Endpoint
- URL:
https://your-project.convex.cloud/resend-webhook
- Events: Select all
email.*
events - Copy the webhook signing secret
-
Update Convex environment variable:
- Add
RESEND_WEBHOOK_SECRET=whsec_...
to your Convex production environment
- Add
Step 6: Final Configuration Updates
Update Clerk Production Settings
-
Add production domains:
- Go to Configure → Instance Settings
- Add your production domain to allowed origins
- Remove development/localhost URLs
-
Update JWT Template for Convex:
- Go to Configure → JWT Templates
- Find your Convex template
- Ensure it’s properly configured for production
Update Frontend URL in Convex
Critical: Update theFRONTEND_URL
in your Convex production environment variables to your actual domain:
Step 7: Test Production Deployment
Complete User Flow Test
-
Authentication:
- Sign up with a new account
- Verify email works
- Test login/logout
-
Payments (if enabled):
- Test subscription signup
- Use test card:
4242 4242 4242 4242
- Verify dashboard access after payment
- Test subscription management
-
Core Features:
- Test all main app functionality
- Verify real-time features work
- Test email notifications
Monitor Service Dashboards
Check logs and metrics in:- Convex Dashboard → Logs
- Clerk Dashboard → Activity
- Polar Dashboard → Webhooks
- Resend Dashboard → Logs
- Vercel Dashboard → Functions
Production Checklist
- Custom domain configured and working
- Convex deployed to production with all environment variables
- Vercel deployed with correct environment variables
- Clerk switched to production mode with domain configured
- Polar.sh production account with webhooks configured
- Resend production API key with domain verified
- All webhooks pointing to production Convex URL
- Complete user flow tested end-to-end
- OAuth providers configured for production (if applicable)
- Subscription plans created in production Polar
- Email templates working with production domain
Troubleshooting
Authentication Issues:- Verify Clerk domain settings include your production URL
- Check JWT template configuration in Clerk
- Ensure OAuth apps are in “production” mode (not “testing”)
- Verify Polar webhook URL points to production Convex
- Check webhook secret matches in both Polar and Convex
- Ensure using production Polar account (not sandbox)
- Verify domain authentication in Resend
- Check webhook secret matches in both Resend and Convex
- Ensure sender email domain is verified
- Check Convex logs for backend errors
- Verify all environment variables are set correctly
- Ensure frontend URL is set correctly in Convex (no trailing slash)
🎉 Congratulations! Your Kaizen application is now live in production. Monitor your service dashboards for the first few days to ensure everything is working smoothly.