General
Deployment

Render

Learn how to deploy your application to Render.

Render is a cloud platform that makes it easy to deploy full-stack applications. It offers a free tier and supports both static sites and web services.

Why Render?

  • Free tier available - Great for testing and MVPs
  • Simple deployment - Connect GitHub and deploy automatically
  • Automatic HTTPS - SSL certificates included
  • Database support - Can provision PostgreSQL
  • No cold starts - Better performance than serverless

Deploying to Render

1. Create Render Account

Sign up for a free account at render.com.

2. Create New Web Service

  1. Click "New +" in the Render dashboard
  2. Select "Web Service"
  3. Choose "Build and deploy from a Git repository"
  4. Connect your GitHub account if prompted
  5. Select your repository

3. Configure Service

Set the following configuration:

  • Name: Your application name
  • Region: Choose closest to your users
  • Branch: main or your production branch
  • Root Directory: / (leave empty if root)
  • Runtime: Node
  • Build Command: npm run build
  • Start Command: npm start

4. Add Environment Variables

Add all required environment variables:

  1. Scroll to "Environment Variables" section
  2. Add variables from your .env:
Render Environment Variables
DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=...
NEXT_PUBLIC_SITE_URL=https://your-app.onrender.com
STRIPE_SECRET_KEY=...
STRIPE_PUBLISHABLE_KEY=...
RESEND_API_KEY=...
EMAIL_FROM=...

5. Select Plan

  • Free: Good for testing, but service sleeps after inactivity
  • Starter ($7/month): Always-on, better for production
  • Professional: More resources for high-traffic apps

6. Deploy

Click "Create Web Service" and Render will:

  • Install dependencies
  • Build your application
  • Deploy to their infrastructure

Your app will be available at https://your-app.onrender.com.

Database Migrations

To run migrations on Render:

  1. Option 1: Add to build command

    • Update build command: npm run build && npm run db:migrate (or npm run db:push for development)
  2. Option 2: Use Render Shell

    • Go to your service → "Shell" tab
    • Run: npm run db:migrate
  3. Option 3: One-time migration

    • Create a one-off deploy to run migrations

Provision Database (Optional)

Render can provision a PostgreSQL database:

  1. Click "New +""PostgreSQL"
  2. Configure database settings
  3. Render will automatically set DATABASE_URL
  4. Link the database to your web service

Custom Domain

To use a custom domain:

  1. Go to SettingsCustom Domains
  2. Add your domain
  3. Follow DNS configuration instructions
  4. Update NEXT_PUBLIC_SITE_URL to your custom domain

Auto-Deploy

Render automatically deploys when you push to your connected branch. You can:

  • Enable/disable auto-deploy in settings
  • Set up manual deploys
  • Configure deploy hooks

Monitoring

Render provides:

  • Logs - Real-time application logs
  • Metrics - CPU, memory usage
  • Events - Deployment history

Troubleshooting

Service Sleeping (Free Tier)

The free tier service sleeps after 15 minutes of inactivity. To prevent this:

  • Upgrade to a paid plan
  • Use a service like UptimeRobot to ping your app

Build Failures

  • Check build logs in the Render dashboard
  • Verify Node.js version (Render uses Node 18 by default)
  • Ensure all dependencies are in package.json

Database Connection Issues

  • Verify DATABASE_URL is set correctly
  • Check if database requires SSL (add ?sslmode=require)
  • Ensure database and web service are in the same region

Environment Variables

  • Verify variables are set correctly
  • Redeploy after adding new variables
  • Check for typos in variable names