First Deployment
Deploy your RankThis SaaS to production on Vercel with database migrations and environment configuration.
Make sure you have completed these steps:
- ✅ Local installation working
- ✅ Environment variables configured
- ✅ Database connection tested
- 📧 Email service configured
- 💳 Stripe webhooks ready
- 🔐 Google OAuth credentials
Step 1: Prepare for Production
Generate and apply database migrations for production:
# Create migration from your schema changespnpm db:generate# Review the generated migration filecat prisma/migrations/[timestamp]_*/migration.sql# Apply migrations to production databasepnpm db:migrate
⚠️ Important
Always review migration files before applying to production. Backup your database if you have existing data.
Update your environment variables for production:
# Update these for productionNEXTAUTH_URL="https://yourdomain.com"DATABASE_URL="postgresql://production-connection-string"# Use production API keysSTRIPE_SECRET_KEY="sk_live_..."NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_live_..."RESEND_API_KEY="re_live_..."
Keep development keys in your local .env file. We'll configure production keys in Vercel's dashboard.
Step 2: Deploy to Vercel
- 1. Push to GitHub# Commit your changesgit add .git commit -m "Ready for production deployment"git push origin main
- 2. Connect to Vercel
- • Go to vercel.com and sign in
- • Click "New Project"
- • Import your GitHub repository
- • Vercel will auto-detect Next.js settings
Add your production environment variables in Vercel:
- 1. In your Vercel project dashboard, go to Settings → Environment Variables
- 2. Add each variable from your production .env file
- 3. Set the environment to Production
- 4. Click Save for each variable
🔒 Security Tip
Add sensitive variables (API keys, secrets) directly in Vercel's dashboard. Never include them in your code repository.
Deploy your application:
- 1. Click "Deploy" in Vercel
- 2. Wait for the build to complete (~2-3 minutes)
- 3. Vercel will provide your production URL
- 4. Test your deployment
🎉 Deployment Complete!
Your SaaS is now live! You'll get a URL like:https://your-project.vercel.app
Step 3: Post-Deployment Setup
Update your external services with your production URL:
🔐 Google OAuth
Add your production callback URL to Google Console:
1https://yourdomain.com/api/auth/callback/google
💳 Stripe Webhooks
Create a webhook endpoint in Stripe Dashboard:
1https://yourdomain.com/api/webhooks/stripe
Select events: customer.subscription.*, invoice.*
📧 Resend Domain
Verify your sending domain in Resend dashboard to improve deliverability.
Verify everything works in production:
Core Features
- • Sign up/sign in works
- • Database connections active
- • Pages load correctly
- • Theme switching works
Optional Features
- • Email sending works
- • Stripe payments process
- • Analytics tracking
- • Admin panel accessible
Step 4: Custom Domain (Optional)
Replace the Vercel URL with your custom domain:
- 1. In Vercel project settings, go to Domains
- 2. Add your domain (e.g.,
yoursaas.com) - 3. Configure DNS records with your domain provider:
- • Add CNAME record pointing to Vercel
- • Or follow Vercel's specific DNS instructions
- 4. Update
NEXTAUTH_URLenvironment variable - 5. Update OAuth and webhook URLs in external services
Built-in Monitoring
- • Vercel provides deployment logs
- • Function execution metrics
- • Performance insights
Your Admin Dashboard
- • User analytics and metrics
- • Subscription tracking
- • Error monitoring via logs
Build Fails
Check TypeScript errors, missing dependencies, or incorrect environment variables.
Database Connection Error
Verify DATABASE_URL is correct and database is accessible from Vercel.
Authentication Issues
Check NEXTAUTH_URL matches your domain and OAuth redirect URLs are updated.
Stripe Webhooks Not Working
Verify webhook URL in Stripe dashboard and STRIPE_WEBHOOK_SECRET is correct.
🚀 Your SaaS is Live!
Congratulations! Your RankThis SaaS is now running in production. Ready to dive deeper into the features?