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
- Click "New +" in the Render dashboard
- Select "Web Service"
- Choose "Build and deploy from a Git repository"
- Connect your GitHub account if prompted
- Select your repository
3. Configure Service
Set the following configuration:
- Name: Your application name
- Region: Choose closest to your users
- Branch:
mainor 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:
- Scroll to "Environment Variables" section
- Add variables from your
.env:
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
- Generate Prisma Client
- 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:
-
Option 1: Add to build command
- Update build command:
npm run build && npx prisma migrate deploy
- Update build command:
-
Option 2: Use Render Shell
- Go to your service → "Shell" tab
- Run:
npx prisma migrate deploy
-
Option 3: One-time migration
- Create a one-off deploy to run migrations
Provision Database (Optional)
Render can provision a PostgreSQL database:
- Click "New +" → "PostgreSQL"
- Configure database settings
- Render will automatically set
DATABASE_URL - Link the database to your web service
Custom Domain
To use a custom domain:
- Go to Settings → Custom Domains
- Add your domain
- Follow DNS configuration instructions
- Update
NEXT_PUBLIC_SITE_URLto 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 - Make sure Prisma Client is generated:
npx prisma generate
Database Connection Issues
- Verify
DATABASE_URLis 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