First Deployment

Deploy your RankThis SaaS to production on Vercel with database migrations and environment configuration.

Before You Deploy

Make sure you have completed these steps:

Required
  • ✅ Local installation working
  • ✅ Environment variables configured
  • ✅ Database connection tested
Recommended
  • 📧 Email service configured
  • 💳 Stripe webhooks ready
  • 🔐 Google OAuth credentials

Step 1: Prepare for Production

Database Migration

Generate and apply database migrations for production:

# Create migration from your schema changes
pnpm db:generate
# Review the generated migration file
cat prisma/migrations/[timestamp]_*/migration.sql
# Apply migrations to production database
pnpm db:migrate

⚠️ Important

Always review migration files before applying to production. Backup your database if you have existing data.

Production Environment Variables

Update your environment variables for production:

Production .env
# Update these for production
NEXTAUTH_URL="https://yourdomain.com"
DATABASE_URL="postgresql://production-connection-string"
# Use production API keys
STRIPE_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

Connect Your Repository
  1. 1. Push to GitHub
    # Commit your changes
    git add .
    git commit -m "Ready for production deployment"
    git push origin main
  2. 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
Configure Environment Variables

Add your production environment variables in Vercel:

  1. 1. In your Vercel project dashboard, go to Settings → Environment Variables
  2. 2. Add each variable from your production .env file
  3. 3. Set the environment to Production
  4. 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

Deploy your application:

  1. 1. Click "Deploy" in Vercel
  2. 2. Wait for the build to complete (~2-3 minutes)
  3. 3. Vercel will provide your production URL
  4. 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 Service Configurations

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.

Test Your Production Deployment

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)

Add Your Custom Domain

Replace the Vercel URL with your custom domain:

  1. 1. In Vercel project settings, go to Domains
  2. 2. Add your domain (e.g., yoursaas.com)
  3. 3. Configure DNS records with your domain provider:
    • • Add CNAME record pointing to Vercel
    • • Or follow Vercel's specific DNS instructions
  4. 4. Update NEXTAUTH_URL environment variable
  5. 5. Update OAuth and webhook URLs in external services
📊 Monitoring & Maintenance

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
🔧 Common Deployment Issues

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?