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 minutes

One-Click Deploy#

Deploy to Render

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_SECRET and CRON_SECRET

Manual Setup#

Create a PostgreSQL database

  1. Go to render.com and create a new PostgreSQL database
  2. Select the Starter plan (free for 90 days, then $7/month)
  3. Note the Internal Database URL for connecting your web service

Create a web service

  1. Click New > Web Service
  2. Connect your GitHub repository
  3. 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:

  1. Click New > Cron Job
  2. Schedule: 0 * * * * (every hour)
  3. 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#

  1. In Render, go to your web service > Settings > Custom Domains
  2. Add your domain (e.g., analytics.yourdomain.com)
  3. Configure DNS:
    • CNAME record: your-service.onrender.com
    • Or use Render's nameservers for automatic SSL
  4. Update NEXTAUTH_URL to 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 .npmrc with fund=false and audit=false
  • Ensure node_modules is in .gitignore
  • Consider using npm ci instead of npm install (faster)