Render Deployment
Deploy JustAnalytics on Render with the Blueprint configuration
Render Deployment
Deploy your own JustAnalytics instance on Render using the Blueprint configuration. The blueprint provisions a PostgreSQL database and web service with all necessary configuration.
Time to data: 5 minutesOne-Click Deploy#
This creates:
- A web service running the JustAnalytics Next.js application
- A PostgreSQL database (Starter plan)
- A cron job for hourly data aggregation
- Auto-generated secrets for
NEXTAUTH_SECRETandCRON_SECRET
Manual Setup#
Create a PostgreSQL database
- Go to render.com and create a new PostgreSQL database
- Select the Starter plan (free for 90 days, then $7/month)
- Note the Internal Database URL for connecting your web service
Create a web service
- Click New > Web Service
- Connect your GitHub repository
- Configure:
- Runtime: Node
- Build command:
npm ci && npx prisma generate && npm run build - Start command:
npx prisma db push --skip-generate && npm start - Plan: Starter ($7/month) or higher
Configure environment variables
In the web service settings, add:
| Variable | Value | Notes |
|----------|-------|-------|
| DATABASE_URL | Internal Database URL | From your PostgreSQL instance |
| NEXTAUTH_URL | https://your-service.onrender.com | Your Render URL |
| NEXTAUTH_SECRET | (generate) | openssl rand -base64 32 |
| NODE_ENV | production | |
| GOOGLE_CLIENT_ID | Your Google OAuth ID | Optional |
| GOOGLE_CLIENT_SECRET | Your Google OAuth secret | Optional |
| RESEND_API_KEY | Your Resend key | Optional, for emails |
| CRON_SECRET | (generate) | For cron job auth |
Set up health checks
In the web service settings:
- Health Check Path:
/api/health - This ensures Render only routes traffic to healthy instances
Set up cron job (optional)
For data aggregation, create a Cron Job service:
- Click New > Cron Job
- Schedule:
0 * * * *(every hour) - Command:
curl -s -H 'Authorization: Bearer YOUR_CRON_SECRET' https://your-service.onrender.com/api/cron/aggregate
Blueprint Configuration#
The render.yaml in the repository root configures all services automatically:
databases:
- name: justanalytics-db
plan: starter
services:
- type: web
name: justanalytics
buildCommand: npm ci && npx prisma generate && npm run build
startCommand: npx prisma db push --skip-generate && npm start
healthCheckPath: /api/health
envVars:
- key: DATABASE_URL
fromDatabase:
name: justanalytics-db
property: connectionString
- key: NEXTAUTH_SECRET
generateValue: true
Cost Estimate#
| Service | Plan | Cost | |---------|------|------| | Web Service | Starter | $7/month | | PostgreSQL | Starter | Free (90 days) then $7/month | | Cron Job | Starter | $1/month | | Total | | $8-15/month |
For higher traffic (1M+ events/month), upgrade to the Standard plan for more CPU and memory.
Custom Domain#
- In Render, go to your web service > Settings > Custom Domains
- Add your domain (e.g.,
analytics.yourdomain.com) - Configure DNS:
- CNAME record:
your-service.onrender.com - Or use Render's nameservers for automatic SSL
- CNAME record:
- Update
NEXTAUTH_URLto match your custom domain
Troubleshooting#
Cold starts#
Render's Starter plan spins down after 15 minutes of inactivity. To avoid cold starts:
- Upgrade to the Standard plan ($25/month, always-on)
- Or set up an uptime monitor to keep the service warm
Database connection limits#
Render's Starter PostgreSQL allows 97 connections. If you hit limits:
- Ensure connection pooling is configured (Prisma handles this automatically)
- Consider upgrading to Standard PostgreSQL for more connections
Build timeouts#
If builds exceed 30 minutes:
- Add a
.npmrcwithfund=falseandaudit=false - Ensure
node_modulesis in.gitignore - Consider using
npm ciinstead ofnpm install(faster)