Overview
This guide covers deploying Your Bible to production, including environment configuration, database setup, and platform-specific instructions.Pre-Deployment Checklist
Before deploying, ensure you have:- All required API keys and credentials
- Production database provisioned
- Convex production deployment created
- Redis/KV instance for production
- Domain name (optional but recommended)
- SSL certificate (handled by most platforms)
- Environment variables documented
Production Environment Setup
Environment Variables
Prepare your production environment variables:Security Considerations
Generate Production Secrets
Generate a new Never reuse development secrets in production.
BETTER_AUTH_SECRET for production:Update OAuth Callbacks
Update your OAuth application callback URLs to use your production domain:
- GitHub:
https://yourdomain.com/api/auth/callback/github
Deploying to Vercel
Vercel is the recommended platform for deploying Your Bible, offering seamless integration with the tech stack.Prerequisites
- Vercel account (sign up)
- GitHub repository with your code
- All required credentials ready
Deployment Steps
Connect GitHub Repository
- Go to Vercel Dashboard
- Click “Add New” → “Project”
- Import your GitHub repository
- Vercel will automatically detect the framework
Configure Build Settings
Vercel should auto-detect the settings, but verify:
- Framework Preset: Vite
- Build Command:
pnpm buildornpm run build - Output Directory:
.output(TanStack Start default) - Install Command:
pnpm installornpm install
Add Environment Variables
In the project settings, add all environment variables from your
.env file:- Go to Settings → Environment Variables
- Add each variable from the production environment list above
- Set them for “Production” environment
- Remember to update
BETTER_AUTH_URLto your Vercel domain
Deploy
Click “Deploy” and wait for the build to complete. Vercel will:
- Install dependencies
- Build your application
- Deploy to a production URL
- Provide a deployment URL
Vercel-Specific Services
Vercel Postgres
Create Database
- Go to Storage tab in Vercel dashboard
- Create a new Postgres database
- Copy the
DATABASE_URLconnection string
Vercel KV (Redis)
Create KV Database
- Go to Storage tab in Vercel dashboard
- Create a new KV database
- Vercel will automatically add the required environment variables
Deploying to Netlify
Netlify is another excellent option for deploying Your Bible.Connect Repository
- Go to Netlify Dashboard
- Click “Add new site” → “Import an existing project”
- Connect your GitHub repository
Configure Build Settings
- Build command:
pnpm buildornpm run build - Publish directory:
.output/public - Functions directory:
.output/server
Add Environment Variables
In Site settings → Environment variables, add all production environment variables.
For Netlify, you’ll need to set up external services for PostgreSQL and Redis since Netlify doesn’t provide these natively.
Database Migrations
Better Auth and Drizzle ORM handle database schema automatically, but follow these steps for production:Run Initial Migration
On first deployment, Better Auth will automatically create required tables:
userssessionsaccountsverificationTokens
Convex Production Deployment
Deploy your Convex schema to production:Verify Deployment
Check the Convex Dashboard to ensure:
- Schema is deployed correctly
- All tables are present
- Indexes are created
Post-Deployment Checklist
After deployment, verify everything is working:Functionality Tests
-
Homepage loads correctly
- Navigate to your production URL
- Verify the homepage renders without errors
-
Authentication works
- Test sign up with a new account
- Test sign in with existing credentials
- Verify session persistence after page reload
- Test sign out functionality
-
Bible reading functionality
- Select a Bible translation
- Navigate between chapters
- Verify verse highlighting works
- Check that chapter text loads correctly
-
Search functionality
- Perform a keyword search
- Verify results display correctly
- Test pagination
- Check verse reference links
-
Collections work
- Create a new collection
- Add verses to collection
- Edit collection name
- Delete collection
- Verify real-time sync (open in two tabs)
-
Notes functionality
- Create a note for a chapter
- Edit existing notes
- Verify rich text formatting
- Check real-time sync
-
Story generation
- Generate a new story
- Verify AI response
- Check rate limiting works
- Confirm stories are saved
Performance Tests
- Page load times are acceptable
- API responses are fast
- Real-time updates sync quickly
- Mobile responsiveness works well
Security Tests
- SSL certificate is active and valid
- Protected routes require authentication
- Rate limiting prevents abuse
- CORS is properly configured
- Environment variables are not exposed
Monitoring and Maintenance
Setting Up Monitoring
Enable Platform Analytics
- Vercel: Analytics is available in the dashboard
- Netlify: Enable analytics in site settings
Monitor Error Logs
Regularly check logs for errors:
- Vercel: Functions → Logs
- Netlify: Functions → Logs
- Convex: Dashboard → Logs
Regular Maintenance
- Update Dependencies: Regularly update npm packages for security patches
- Monitor API Usage: Check API usage to avoid unexpected costs
- Review Logs: Regularly review application logs for errors
- Backup Data: Implement regular database backups
- Test Functionality: Periodically test all features
Performance Optimization
Troubleshooting Deployment Issues
Build Failures
If the build fails:- Check build logs for specific error messages
- Verify dependencies are correctly specified in
package.json - Test build locally:
- Check Node.js version matches your development environment
Environment Variable Issues
If environment variables aren’t working:- Verify all required variables are set
- Check variable names for typos
- Ensure no trailing spaces in values
- Redeploy after adding/updating variables
Database Connection Errors
If database connection fails:- Verify
DATABASE_URLis correct - Check SSL mode is enabled
- Ensure database allows connections from your hosting platform
- Test connection using a database client
Authentication Issues
If authentication doesn’t work:- Verify
BETTER_AUTH_URLmatches your domain - Check
BETTER_AUTH_SECRETis set - Ensure OAuth callbacks are correctly configured
- Test locally with production environment variables
Convex Connection Issues
If Convex data doesn’t sync:- Verify
VITE_CONVEX_URLis correct - Check Convex deployment status in dashboard
- Ensure schema is deployed to production
- Review Convex logs for errors
Rollback Procedures
If something goes wrong:Vercel Rollback
- Go to Deployments tab
- Find the last working deployment
- Click ”⋯” → “Promote to Production”
Netlify Rollback
- Go to Deploys tab
- Find the last successful deployment
- Click “Publish deploy”
Database Rollback
If you need to restore the database:Continuous Deployment
Both Vercel and Netlify support automatic deployments:- Production: Deploys automatically on push to
mainbranch - Preview: Creates preview deployments for pull requests
- Branch Deploys: Optionally deploy other branches
Cost Management
Monitor costs for external services:- API.Bible: 1,000 free requests/day, monitor usage
- Google Gemini: Free tier limits, implement rate limiting
- Database: Monitor storage and connection usage
- Redis: Track memory usage and connection count
- Hosting: Most platforms have free tiers for small projects