This page was last updated on: 17th September 2025
DO NOT upgrade any dependencies in your package.json for the core stack dependencies (Clerk, Convex, Polar.sh, etc.), unless you have a specific reason to and are following the official migration guides from each service. Upgrading packages without proper migration can break your authentication, database connections, and other critical functionality. The current versions in the boilerplate are tested and stable together.
Pre-requisites
- Frontend Knowledge (Have completed the Frontend section of the Software Engineer Roadmap) so that your base HTML, CSS, JS and React skills are up to par.
- Fundamental Backend Systems Knowledge (Have completed the Systems Expert Fundamentals Course of the Software Engineer Roadmap)
- Fundamental Tech Stack Knowledge (Have completed the Kaizen Tech Stack Tutorial)
Tech Stack
- React Router v7 - Modern full-stack React framework with SSR
- Convex - Real-time database and serverless functions
- Clerk - Authentication as a Service Provider
- Polar.sh - Subscription billing and payments
- Resend - Email as a Service Provider
- OpenAI - AI chat capabilities (optional)
- Vercel - Deployments without worrying about infrastructure (Auto-Scaling, DDoS protection, etc.)
Cost of running this stack
All of the above services have generous free tiers. Even as your product grows, the cost remains minimal (averaging $200-300/month with 10,000+ DAUs for 80%+ profit margin). These 3rd party services abstract away significant infrastructure work in key areas (authentication, database, payments, etc.), letting you focus solely on building your product.Building with Kaizen
1
Prerequisites
-
Install the latest stable version of Node.js (If you already have Node.js installed, this will override it):
- Mac/Linux: Install via nvm:
Should return something likev24.x.y
(at the time of writing: 24.6.0) - Mac/Linux: Install via nvm:
-
Install ngrok for webhook testing:
-
Create a new empty GitHub repository for your project
Have the SSH repository URL ready (e.g.,
git@github.com:username/repo-name.git
)Make sure it’s the SSH URL, not the HTTPS URL! - Gather your Development API keys from the following services:
If you have your own agency and you’re building for a client, you’ll need to create all the below accounts for them using your own agency company email account and then transfer ownership to them later when the contract ends.See the Account Management Guide for more information on how to do this.
-
Clerk (Authentication)
- Create an account at Clerk (or new ‘Application’ if you already have an account)
- Create a new Application and select “React Router” as your framework
- Enable Email/Password and Google authentication methods
- Copy your
VITE_CLERK_PUBLISHABLE_KEY
andCLERK_SECRET_KEY
from the ‘API Keys’ section - Add them to somewhere safe (ideally if you’re using a clipboard manager, you’ll be able to paste them into your
.env
file later)
-
Convex (Database)
- Create an account at Convex
- We’ll set this up in the next step when you clone the repo
-
Polar.sh (Subscriptions) - Optional for initial setup
- Create an account at sandbox.polar.sh
- Create a new organization
- Create a subscription plan
- Copy your API keys from Settings
- Add them to somewhere safe
-
Resend (Email) - Optional for initial setup
- Create an account at Resend
- Generate an API key from the API Keys section
- Add it to somewhere safe
-
OpenAI (AI Chat) - Optional
- Create an account at OpenAI
- Generate an API key from the API Keys section
- Copy your
OPENAI_API_KEY
- Add it to somewhere safe
2
Clone and Setup Project
- Create a fresh repository on GitHub (private - if you want to keep it private)
-
Clone the Kaizen repository and set up your project:
-
Install dependencies:
We use
--legacy-peer-deps
because some packages might have React 18 peer dependencies while we’re using React 19. -
Copy environment template:
-
Verify build works:
3
Configure Features Step by Step
Kaizen uses a progressive configuration approach where you can enable features one by one. Start with basic configuration and add services as needed.Once your app works locally, we can deploy to production
Start with Static Configuration (No Services)
First, let’s make sure everything builds and runs without any external services:-
Edit your
config.ts
file to disable all features: -
Test the basic setup:
-
Visit
http://localhost:5173
- you should see the homepage load successfully
Enable Authentication and Convex
-
Update your
config.ts
: -
Set up Convex:
- Follow prompts to log in to Convex
- Create a new project when prompted (or select existing)
- This automatically updates your
.env.local
file env vars (VITE_CONVEX_URL, CONVEX_DEPLOYMENT) - Keep this terminal running (Convex development server)
-
Add your Clerk keys to your
.env.local
file: -
Configure Clerk JWT templates for Convex integration:
- In Clerk Dashboard: Go to Configure → JWT Templates
- Click New template → Convex
- Click Save (important - don’t forget this step!)
- Copy the Issuer URL (looks like
https://your-app.clerk.accounts.dev
)
-
Configure Convex to use your Clerk JWT template:
- Go to your Convex project dashboard (Make sure you’re on the ‘development’ environment)
- Navigate to Settings → Environment Variables
- Add:
VITE_CLERK_FRONTEND_API_URL
with the Issuer URL from step 4 - This enables Convex to verify Clerk JWT tokens
-
Also add this env var to your
.env.local
file:
It’s the same as your
VITE_CONVEX_URL
Make sure that there isn’t a forward slash at the end of the URL! This is important!- Shutdown and Restart your development server. Authentication should now be working.
Enable Payments (Polar.sh)
-
Update your
config.ts
: -
Run ngrok:
Copy the HTTPS URL (e.g.,
https://abc123.ngrok.io
) -
Set your local frontend URL in your
.env.local
file: -
Update
vite.config.ts
with the new ngrok URL: -
CRITICAL: Add the below environment variables to Convex Dashboard (not local .env):
- Go to your Convex project dashboard
- Navigate to Settings → Environment Variables
- Get your Polar variables from the Polar Dashboard:
sandbox
for development -
Configure webhook in Polar Dashboard:
- Get your Convex HTTP actions URL from dashboard (ends in
.convex.site
) - Go to Settings → Webhooks → Add Endpoint
- URL:
https://your-deployment.convex.site/payments/webhook
- Format: Raw
- Click Generate new secret and copy it
- Select all events and click Create
- Copy the webhook secret and add it to your Convex Environment Variables:
- Get your Convex HTTP actions URL from dashboard (ends in
-
Test payments:
- Use your ngrok URL in browser (not localhost)
- Sign up/login with test account
- Click on the plan you created
- Use test card:
4242 4242 4242 4242
, any future date, any CVC - Verify redirect to success page and dashboard access
Deploy to Production
Pre-Requisite: You need to have purchased a domain already
- Setup Clerk for Production
- Setup Polar for Production
production
in your production environment variablesFor POLAR_WEBHOOK_SECRET, use https://your-prod-name.convex.site/payments/webhook`
- Setup Convex for Production
- Create a new project in your Vercel account
- Select your github repo and set the ‘Build Command’ to:
- Set your Environment Variables
prod:...
iii) Update your VITE_CONVEX_URL to be your prod name: i.e. https://your-prod-name.convex.cloud
iv) Set up the CONVEX_DEPLOY_KEY environment variableGo to your project’s Settings page. Click the Generate Production Deploy Key button to generate a Production deploy key. Then click the copy button to copy the key.Back in Vercel, add an environment variable below the others, named CONVEX_DEPLOY_KEY and paste in your deploy key.iii) Now you can click ‘Deploy’Enable Email (Resend)
-
Update your
config.ts
: -
Create Resend account:
- Go to resend.com and create an account
- Generate an API key from API Keys section (select Full Access)
- Copy the API key (starts with
re_
)
-
Choose your email setup approach:
Option A: Quick Testing (No Domain Required)
- Use Resend’s built-in sandbox domain
- Sender email:
onboarding@resend.dev
(works immediately) - Can only send to your Resend account email address
- Verify your own domain for branded emails
- Go to Domains → Add Domain → Enter your domain
- Add required DNS records (TXT, MX, CNAME) to your domain registrar
- Wait for verification (can take minutes to hours)
- Sender email:
noreply@yourdomain.com
(after verification)
-
CRITICAL: Add environment variables to Convex Dashboard (not local .env):
- Go to your Convex project dashboard
- Navigate to Settings → Environment Variables
- Add these variables:
-
Set up webhook for email events:
- Get your Convex HTTP actions URL (ends in
.convex.site
) - In Resend dashboard → Webhooks → Add Endpoint
- URL:
https://your-deployment.convex.site/resend-webhook
- Enable all
email.*
events - Copy webhook secret and add it to your Convex Environment Variables:
- Get your Convex HTTP actions URL (ends in
-
Test email functionality:
- Navigate to
/dashboard
(must be authenticated) - Find the “Test Email” form in dashboard
- Important: For local development, use your Resend account email address as recipient!
- Send test email and check spam folder (sandbox emails often go there)
- Verify success in Resend dashboard → Logs
- Navigate to
🎉 Hooray! You’ve now successfully configured your app. You’re ready to start building and shipping features.
Enable AI Chat (OpenAI) - Optional
-
Add OpenAI API key:
-
Update your
config.ts
: -
Add your OpenAI API key to your Convex Environment Variables:
- Go to your Convex project dashboard
- Navigate to Settings → Environment Variables
- Add:
OPENAI_API_KEY=sk-...
Returning to work on any Kaizen project
Important: When returning to work on your projectStart these in three separate terminals:
- Terminal 1:
- Terminal 2:
- Terminal 3 (only when testing webhooks like payments):
- Update the
FRONTEND_URL
in your.env.local
file with the new ngrok URL - Update your Convex environment variable
FRONTEND_URL
with the new ngrok URL - Update
vite.config.ts
→server.allowedHosts
with the new ngrok host (same as initial setup) - Restart both your Convex dev server and your app dev server after those changes
ngrok is only required when testing webhooks (e.g., payments, emails). After completing a local subscription test, you can switch your browser back to
http://localhost:5173
immediately; no server restarts are needed. Keep ngrok running only when you need to receive webhooks.4
Building the Product
At this point, you should have a clean and beautiful landing page that explains the product and what it does, with authentication and optionally payments configured.Now it’s time to add the main functionality of your product:
- Dashboard: Users get redirected here after signing up
- Core Features: The main value proposition of your SaaS
- Settings: User profile management and subscription handling
5
Testing Your Application
6
Deploying the App to Production
You’ll need to purchase a domain before deploying to production. Services like Clerk and Polar require a verified domain for production environments. Purchase a domain from providers like Namecheap, Porkbun, GoDaddy, or Google Domains before proceeding with production deployment.
- Domain purchase and setup
- Production database configuration (Convex)
- Production authentication setup (Clerk)
- Production subscription setup (Polar.sh)
- Vercel deployment
- Post-deployment verification