Production Environment Setup
Step-by-step guide to configure Dashtray for production deployment.Overview
This guide covers:- Convex production deployment
- Cloudflare Pages project setup
- Environment variable configuration
- Custom domain and SSL setup
- DodoPayments webhook configuration
Prerequisites Checklist
- Convex account created
- Cloudflare account created
- DodoPayments account created
- Resend account created
- Domain name purchased (optional)
- GitHub repository set up
- Local development environment working
Step 1: Configure Convex Production
1.1 Create Production Deployment
- Deployment URL:
https://happy-animal-123.convex.cloud - Site URL:
https://happy-animal-123.convex.site
1.2 Set Production Environment Variables
MASTER_ENCRYPTION_KEY in a secure location (password manager, encrypted file). You’ll need it if you ever need to migrate data.
1.3 Configure Email (Resend)
- Log in to Resend Dashboard
- Go to API Keys
- Create a new API key named “Dashtray Production”
- Copy the API key
1.4 Verify Domain in Resend
- In Resend dashboard, go to Domains
- Click “Add Domain”
- Enter your domain (e.g.,
dashtray.com) - Add the provided DNS records to your domain:
- TXT record for verification
- MX records for receiving
- DKIM records for authentication
- Wait for verification (can take up to 48 hours)
1.5 Configure OAuth (Optional)
Google OAuth
- Go to Google Cloud Console
- Create a new project: “Dashtray Production”
- Enable Google+ API
- Go to Credentials → Create Credentials → OAuth 2.0 Client ID
- Application type: Web application
- Name: “Dashtray”
- Authorized redirect URIs:
- Copy Client ID and Client Secret
GitHub OAuth
- Go to GitHub Settings → Developer settings
- Click “New OAuth App”
- Application name: “Dashtray”
- Homepage URL:
https://dashtray.com - Authorization callback URL:
- Copy Client ID and Client Secret
1.6 Verify Convex Configuration
Step 2: Configure DodoPayments
2.1 Create DodoPayments Account
- Sign up at DodoPayments
- Complete business verification
- Set up payment methods
2.2 Get API Credentials
- Go to Settings → API Keys
- Create a new API key for production
- Copy the API key (starts with
dp_live_)
2.3 Create Products and Prices
- Go to Products in DodoPayments dashboard
- Create products for each tier:
- Name: “Dashtray Pro”
- Price: $69/month
- Billing: Recurring monthly
- Trial: 14 days
- Name: “Dashtray Scale”
- Price: $199/month
- Billing: Recurring monthly
- Trial: 14 days
- Name: “Dashtray Agency”
- Price: $599/month
- Billing: Recurring monthly
- Trial: 14 days
- Note the Product IDs and Price IDs
2.4 Configure Webhook
- In DodoPayments dashboard, go to Webhooks
- Click “Add Endpoint”
- URL:
https://your-deployment.convex.site/api/webhooks/dodo - Events to send:
subscription.createdsubscription.updatedsubscription.canceledpayment.succeededpayment.failed
- Copy the webhook signing secret
2.5 Test Webhook
- In DodoPayments dashboard, go to Webhooks
- Click on your webhook endpoint
- Click “Send test webhook”
- Verify it shows as successful
- Check Convex logs:
npx convex logs --prod
Step 3: Set Up Cloudflare Pages
3.1 Create Cloudflare Pages Project
Option A: Connect Git Repository
- Go to Cloudflare Dashboard
- Navigate to Pages
- Click “Create a project”
- Click “Connect to Git”
- Authorize Cloudflare to access your GitHub/GitLab
- Select your repository
- Configure build settings:
- Project name:
dashtray - Production branch:
main - Build command:
pnpm build - Build output directory:
.svelte-kit/cloudflare - Root directory:
/ - Node version:
18
- Project name:
Option B: Direct Upload (Manual)
-
Build locally:
-
Deploy with Wrangler:
3.2 Configure Environment Variables
In Cloudflare Pages project settings, add:3.3 Configure Build Settings
- Go to Settings → Builds & deployments
- Set Node.js version:
18 - Enable “Automatic deployments” for main branch
- Set build timeout: 20 minutes
3.4 Test Deployment
- Trigger a deployment (push to main or manual deploy)
- Wait for build to complete
- Visit the Cloudflare Pages URL (e.g.,
dashtray.pages.dev) - Verify the site loads correctly
Step 4: Configure Custom Domain and SSL
4.1 Add Custom Domain
- In Cloudflare Pages project, go to “Custom domains”
- Click “Set up a custom domain”
- Enter your domain:
dashtray.com - Click “Continue”
4.2 Configure DNS
Cloudflare will provide DNS instructions. You have two options:Option A: Use Cloudflare Nameservers (Recommended)
- In Cloudflare dashboard, go to Websites
- Click “Add a site”
- Enter your domain
- Choose a plan (Free is fine)
- Cloudflare will provide nameservers
- Update nameservers at your domain registrar
- Wait for DNS propagation (up to 48 hours)
Option B: Use CNAME Record
- In your domain registrar’s DNS settings
- Add a CNAME record:
- Name:
@(or leave blank for root domain) - Value:
dashtray.pages.dev - TTL: Automatic or 3600
- Name:
- Add a CNAME record for www:
- Name:
www - Value:
dashtray.pages.dev - TTL: Automatic or 3600
- Name:
4.3 Enable SSL
SSL is automatic with Cloudflare:- Certificate is provisioned automatically
- Wait 5-10 minutes for activation
- Verify HTTPS works:
https://dashtray.com
4.4 Configure SSL Settings
- In Cloudflare dashboard, go to SSL/TLS
- Set SSL/TLS encryption mode: Full (strict)
- Enable “Always Use HTTPS”
- Enable “Automatic HTTPS Rewrites”
- Set Minimum TLS Version: TLS 1.2
4.5 Update OAuth Redirect URIs
Update OAuth providers with your custom domain: Google OAuth:- Add redirect URI:
https://dashtray.com/api/auth/callback/google
- Update Authorization callback URL:
https://dashtray.com/api/auth/callback/github
4.6 Update Convex SITE_URL
4.7 Update DodoPayments Webhook
- In DodoPayments dashboard, go to Webhooks
- Update webhook URL to use custom domain (if desired):
- Keep:
https://your-deployment.convex.site/api/webhooks/dodo(recommended) - Or use:
https://dashtray.com/api/webhooks/dodo
- Keep:
Step 5: Configure Security Headers
5.1 Add _headers File
Createstatic/_headers:
5.2 Configure CORS
Insrc/convex/http.ts, ensure CORS is configured:
Step 6: Verification Checklist
6.1 Test Authentication
- Sign up with email works
- Email verification received
- Login works
- Password reset works
- Google OAuth works (if configured)
- GitHub OAuth works (if configured)
6.2 Test Core Features
- Create project works
- Connect integration (Stripe) works
- Metrics sync works
- Dashboard displays correctly
- Widgets render correctly
- Alerts work (Pro+ only)
- AI chat works (with API key)
6.3 Test Billing
- Upgrade to Pro works
- DodoPayments checkout loads
- Test payment succeeds
- Webhook received
- Subscription status updated
- Features unlocked
6.4 Test Performance
- Homepage loads < 2s
- Dashboard loads < 3s
- API responses < 500ms
- No console errors
- Mobile responsive
6.5 Test Security
- HTTPS works
- HTTP redirects to HTTPS
- Security headers present
- No sensitive data in logs
- API keys encrypted
- Rate limiting works
Step 7: Monitoring Setup
7.1 Convex Monitoring
- Go to Convex Dashboard
- Select your production deployment
- Set up alerts:
- Error rate > 1%
- Function duration > 5s
- Database query time > 1s
7.2 Cloudflare Analytics
- In Cloudflare Pages, go to Analytics
- Monitor:
- Page views
- Unique visitors
- Bandwidth
- Error rates
7.3 Uptime Monitoring
Set up external monitoring: UptimeRobot (Free):- Sign up at uptimerobot.com
- Add monitor:
- Type: HTTPS
- URL:
https://dashtray.com - Interval: 5 minutes
- Add alert contacts (email, Slack, etc.)
7.4 Error Tracking (Optional)
Sentry:- Sign up at sentry.io
- Create new project
- Install SDK:
- Configure in
src/hooks.client.ts
Step 8: Backup Configuration
8.1 Export Convex Environment Variables
8.2 Document Configuration
Create a secure document with:- Convex deployment URL
- Cloudflare project name
- DodoPayments product IDs
- OAuth client IDs
- Domain registrar details
- DNS configuration
8.3 Set Up Automated Backups
Convex automatically backs up data, but you can also:Troubleshooting
Deployment Fails
Convex deployment fails:- Check build logs in Cloudflare dashboard
- Verify environment variables are set
- Ensure Node.js version is 18
Site Not Loading
- Check DNS propagation: whatsmydns.net
- Verify SSL certificate is active
- Check Cloudflare Pages deployment status
- Review browser console for errors
Webhooks Not Working
- Verify webhook URL is correct
- Check webhook secret matches
- Review Convex logs for errors
- Test webhook in DodoPayments dashboard
Authentication Issues
- Verify
BETTER_AUTH_SECRETis set - Check
SITE_URLmatches actual domain - Verify OAuth redirect URIs are correct
- Check Convex logs for auth errors
Next Steps
- Set up CI/CD (see deployment.md)
- Configure monitoring alerts
- Set up status page
- Create runbook for common issues
- Schedule regular backups
- Plan for scaling
Support
- Documentation: docs.dashtray.com
- Email: support@dashtray.com
- Status: status.dashtray.com