Deploy to Render
Deploy Clarity documentation to Render for easy Node.js hosting with automatic deployments
Deploy to Render
Deploy your Clarity documentation to Render for hassle-free Node.js hosting with automatic deployments and built-in database support.
Why Render?
- π Native Node.js support - Perfect for Astro SSR
- π Auto-deploy from GitHub
- π Free tier available (auto-sleeps after 15 min)
- ποΈ PostgreSQL included - Ready for v1.1 user management
- π Automatic SSL certificates
- π Global CDN included
- π Built-in metrics and logs
Prerequisites
- Render account (sign up free)
- GitHub repository with your Clarity project
- OAuth credentials (optional, for authentication)
Deployment Architecture
Clarity uses two separate services on Render:
- Frontend Service - Astro SSR documentation (main app)
- Backend Service - Express OAuth authentication server
Both deploy automatically from your GitHub repository.
Quick Deploy (Recommended)
The fastest way to deploy is using the included render.yaml blueprint:
Step 1: Connect Repository
- Go to Render Dashboard
- Click New β Blueprint
- Connect your GitHub account
- Select your
clarityrepository - Click Apply
Render will automatically:
- β Create both frontend and backend services
- β Set up environment variables
- β Configure build commands
- β Deploy both apps
Timeline: 3-5 minutes for first deploy
Step 2: Configure Environment Variables
After blueprint deployment, update these variables:
Frontend Service (clarity-docs):
- Go to service β Environment
- Update
PUBLIC_SITE_URLto your Render URL (e.g.,https://clarity-docs.onrender.com)
Backend Service (clarity-backend):
- Go to service β Environment
- Update
FRONTEND_URLto match frontend URL - Add OAuth credentials (if using authentication):
GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGITHUB_CLIENT_IDGITHUB_CLIENT_SECRET
Note: SESSION_SECRET is auto-generated by Render.
Step 3: Redeploy
Click Manual Deploy β Deploy latest commit on both services.
Your site will be live at https://clarity-docs.onrender.com!
Manual Deploy (Alternative)
If you prefer manual setup or customization:
Create Frontend Service
- Dashboard β New β Web Service
- Connect your GitHub repository
- Configure:
Settings:
- Name:
clarity-docs - Region: Oregon (or closest to you)
- Branch:
main - Runtime: Node
- Build Command:
pnpm install && pnpm build - Start Command:
node dist/server/entry.mjs - Plan: Free
Environment Variables:
| Key | Value |
|---|---|
NODE_ENV | production |
HOST | 0.0.0.0 |
PORT | 10000 |
PUBLIC_SITE_NAME | Clarity (or your site name) |
PUBLIC_SITE_DESCRIPTION | Your description |
PUBLIC_SITE_URL | (will be https://your-app.onrender.com) |
PUBLIC_BASE_PATH | / |
- Click Create Web Service
Create Backend Service
- Dashboard β New β Web Service
- Select same GitHub repository
- Configure:
Settings:
- Name:
clarity-backend - Region: Same as frontend
- Branch:
main - Runtime: Node
- Build Command:
cd backend && pnpm install --prod - Start Command:
cd backend && node server.js - Plan: Free
Environment Variables:
| Key | Value |
|---|---|
NODE_ENV | production |
PORT | 10000 |
SESSION_SECRET | Generate: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" |
FRONTEND_URL | https://clarity-docs.onrender.com |
GOOGLE_CLIENT_ID | Your Google OAuth client ID |
GOOGLE_CLIENT_SECRET | Your Google OAuth secret |
GITHUB_CLIENT_ID | Your GitHub OAuth client ID |
GITHUB_CLIENT_SECRET | Your GitHub OAuth secret |
- Click Create Web Service
Step 4: Update OAuth Callbacks
After deployment, update your OAuth provider settings:
Google Cloud Console
- Go to Google Cloud Console
- APIs & Services β Credentials
- Edit your OAuth 2.0 Client ID
- Add to Authorized redirect URIs:
https://clarity-backend.onrender.com/auth/google/callback
GitHub OAuth App
- Go to GitHub Developer Settings
- Select your OAuth App
- Update Authorization callback URL:
https://clarity-backend.onrender.com/auth/github/callback
Step 5: Verify Deployment
- Visit your frontend URL:
https://clarity-docs.onrender.com - Navigate through documentation
- Test search (Cmd/Ctrl + K)
- Try authentication (if configured)
- Check SSL certificate (should be automatic)
Note: Free tier apps sleep after 15 minutes of inactivity. First request after sleep takes 1-2 seconds to wake up.
Custom Domain Setup
Add Custom Domain
- Go to your frontend service β Settings β Custom Domains
- Click Add Custom Domain
- Enter your domain (e.g.,
docs.yourdomain.com) - Add DNS records at your domain provider:
For subdomain (docs.yourdomain.com):
Type: CNAME
Name: docs
Value: clarity-docs.onrender.com
For root domain (yourdomain.com):
Type: A
Name: @
Value: [Render IP addresses - shown in dashboard]
- SSL certificate auto-provisions in 5-10 minutes
Update Environment Variables
After custom domain is active:
Frontend service:
- Update
PUBLIC_SITE_URLtohttps://docs.yourdomain.com
Backend service:
- Update
FRONTEND_URLto match - Update OAuth callbacks to use custom domain
Automatic Deployments
Render auto-deploys on every push to your main branch:
# Make changes
git add .
git commit -m "Update documentation"
git push origin main
# Render automatically:
# 1. Detects push
# 2. Runs build
# 3. Deploys new version
# 4. Live in 2-3 minutes
Deployment timeline:
- Build: 1-2 minutes
- Deploy: 30-60 seconds
- Total: 2-3 minutes
Environment-Specific Configuration
Enable Preview Environments
- Service β Settings β Deploy
- Enable Preview Environments
- Every pull request gets its own preview URL
Add Database (for v1.1+)
- Dashboard β New β PostgreSQL
- Name:
clarity-db - Region: Same as services
- Plan: Free (256 MB)
- Click Create Database
- In your backend service, add environment variable:
DATABASE_URL: [Copy from database Internal Connection String]
Troubleshooting
Service Wonβt Start
Check logs:
- Service β Logs tab
- Look for errors in startup
Common issues:
- Missing environment variables
- Build command failed
- Wrong start command path
Solution: Verify build/start commands match your project structure.
βApp Not Respondingβ
Free tier sleep behavior:
- Apps sleep after 15 min inactivity
- First request wakes app (1-2s delay)
Solution: Upgrade to paid plan ($7/mo) for always-on.
OAuth Callback Errors
Check:
FRONTEND_URLmatches actual frontend URL- OAuth provider callbacks use correct backend URL
- No trailing slashes in URLs
Build Fails
Check:
- Node version compatibility (Render uses Node 20)
pnpmis available (Render auto-installs)- All dependencies in
package.json
View build logs: Service β Logs β Filter by βbuildβ
Slow Cold Starts
Free tier apps cold start in ~1-2 seconds.
Solutions:
- Upgrade to paid plan (no sleep)
- Use UptimeRobot to ping every 14 minutes (keeps warm)
- Accept cold starts (reasonable for docs)
Advanced Configuration
Add Redis Cache
For faster page loads (optional):
- Dashboard β New β Redis
- Free plan available
- Add
REDIS_URLto frontend service - Implement caching in your app
Enable CDN
- Service β Settings β Advanced
- Enable Render CDN
- Static assets cached globally
Custom Build Command
Edit render.yaml or service settings:
# Build with specific Node version
buildCommand: nvm use 20 && pnpm install && pnpm build
# Build with environment-specific flags
buildCommand: NODE_ENV=production pnpm build
Health Checks
Render automatically pings your app to check health.
Configure in service settings:
- Health Check Path:
/(or custom endpoint) - Health Check Grace Period: 30 seconds
Cost Optimization
Free Tier Limits
Per service:
- 750 hours/month free
- 512 MB RAM
- 0.1 CPU
- Auto-sleep after 15 min
For always-on:
- $7/month per service
- 2 services = $14/month (frontend + backend)
Reduce Costs
-
Use free tier for testing
- Upgrade production only
- Keep staging on free tier
-
Combine services (advanced)
- Run backend as child process of frontend
- Single service = $7/month
-
Use external OAuth (free)
- Auth0, Clerk, Supabase Auth
- Eliminate backend service cost
Monitoring & Logs
View Logs
- Service β Logs
- Filter by: all, build, deploy, run
- Search for specific errors
- Real-time tail
Metrics
- Service β Metrics
- View:
- CPU usage
- Memory usage
- Request count
- Response times
Alerts
- Service β Settings β Notifications
- Enable:
- Deploy success/failure
- Service health issues
- Custom alerts
Deployment Checklist
Before First Deploy
- GitHub repository connected
- OAuth credentials ready (if using auth)
-
render.yamlconfigured - Environment variables documented
After Deployment
- Both services running
- Frontend accessible
- Backend health check passing
- SSL certificate active
- OAuth callbacks updated
- Custom domain configured (optional)
For Production
- Upgrade to paid plan (no sleep)
- Add database (for v1.1)
- Configure alerts
- Set up uptime monitoring
- Document deployment process
Comparison: Render vs Others
| Feature | Render | Vercel | Railway | cPanel |
|---|---|---|---|---|
| Setup | Easy | Easiest | Easy | Hard |
| Node.js SSR | β Native | β Serverless | β Native | β οΈ Complex |
| Backend | β Included | β Separate | β Included | β Yes |
| Database | β PostgreSQL | β Extra | β Yes | β οΈ MySQL |
| Free tier | β Yes | β Yes | β No | N/A |
| Cold starts | ~1-2s | ~0.5s | None | None |
| Always-on cost | $7/mo | $20/mo | $5/mo | Variable |
| Auto-deploy | β Yes | β Yes | β Yes | β οΈ Manual |
Whatβs Next?
- Configure authentication
- Set up custom domain
- Add database for v1.1
- Configure monitoring
- Optimize performance
Resources
Need Help?
Render Support:
Clarity Support:
Was this page helpful?
Thank you for your feedback!