@bettercone/ui
GuidesDeployment

Service Configuration

Configure Convex, Stripe, and email services for production

Service Configuration

Convex Production

Deploy to Production

cd apps/web
npx convex deploy --prod

This creates a production deployment.

Get Production URL

# Output example:
# Deployment: prod:happy-animal-123
# URL: https://happy-animal-123.convex.cloud

Add to Vercel environment variables:

CONVEX_DEPLOYMENT=prod:happy-animal-123
NEXT_PUBLIC_CONVEX_URL=https://happy-animal-123.convex.cloud

Set Environment Variables

npx convex env set STRIPE_SECRET_KEY sk_live_... --prod
npx convex env set RESEND_API_KEY re_... --prod
npx convex env set BETTER_AUTH_SECRET your-secret --prod

Stripe Production

Switch to Live Mode

In Stripe Dashboard, toggle from Test to Live mode.

Get Live API Keys

  1. Go to DevelopersAPI Keys
  2. Copy Publishable key and Secret key
  3. Add to Vercel:
STRIPE_SECRET_KEY=sk_live_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...

Configure Webhook

  1. Go to DevelopersWebhooks
  2. Click Add endpoint
  3. URL: https://yourdomain.com/api/webhooks/stripe
  4. Select events:
    • checkout.session.completed
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.payment_succeeded
    • invoice.payment_failed
  5. Copy Signing secret:
STRIPE_WEBHOOK_SECRET=whsec_...

Test Webhook

stripe listen --forward-to https://yourdomain.com/api/webhooks/stripe
stripe trigger checkout.session.completed

Email Service (Resend)

Create API Key

  1. Go to Resend Dashboard
  2. Click Create API Key
  3. Add to Vercel:
RESEND_API_KEY=re_...
BETTER_AUTH_EMAIL_FROM=noreply@yourdomain.com

Verify Domain

  1. Go to Domains in Resend
  2. Add your domain
  3. Add DNS records:
Type: TXT
Name: resend._domainkey
Value: (provided by Resend)

Better Auth

# Generate secret
BETTER_AUTH_SECRET=$(openssl rand -base64 32)

# Set URL
BETTER_AUTH_URL=https://yourdomain.com

OAuth Providers

GitHub OAuth

Update callback URL:

https://yourdomain.com/api/auth/callback/github

Google OAuth

Update authorized redirect:

https://yourdomain.com/api/auth/callback/google

Always use live mode keys in production. Never commit secrets to git.

Health Checks

Test each service:

# Test Convex
curl https://your-deployment.convex.cloud/_system/ping

# Test Stripe
stripe webhooks test --endpoint https://yourdomain.com/api/webhooks/stripe

# Test Email
# Send test email via Resend dashboard

Resources