Render
Learn how to deploy your application to Render.
Render is a managed cloud platform for deploying web services and PostgreSQL databases from a Git repository.
Why Render?
- Git-based deployment - Build automatically from your production branch
- Managed HTTPS - Connect a custom domain with managed TLS
- Database support - Provision PostgreSQL or connect an external database
- Release controls - Run migrations with a pre-deploy command on supported plans
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 the deployment variables. DATABASE_URL and BETTER_AUTH_SECRET are
required. Add the Stripe and Resend variables when those features are enabled:
- 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=...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=...
STRIPE_WEBHOOK_SECRET=...
NEXT_PUBLIC_STRIPE_PRICE_PRO_MONTHLY=price_...
NEXT_PUBLIC_STRIPE_PRICE_PRO_YEARLY=price_...
NEXT_PUBLIC_STRIPE_PRICE_LIFETIME=price_...
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_STARTER=price_...
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_BASIC=price_...
NEXT_PUBLIC_STRIPE_PRICE_CREDITS_PRO=price_...
RESEND_API_KEY=...
EMAIL_FROM=...5. Select Plan
Choose a plan that supports the uptime, compute and deployment features your application needs. A testing plan can be suitable for evaluation, but use an always-on service for production and confirm that your selected plan supports the pre-deploy migration command described below.
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
Keep the build command as npm run build. On a paid Render service, set the
Pre-Deploy Command to:
npm run db:migrateRender runs this after a successful build and before the new revision goes
live. If your plan does not support pre-deploy commands, run the same command
once from a trusted release environment against the production DATABASE_URL
before deploying the application revision.
Do not use npm run db:push in production and do not run migrations from every
web-service replica at startup.
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 22.21.1 is selected, matching the version in
package.json - Ensure all dependencies are in
package.json
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