# Render Blueprint for the Feater backend (NestJS API + Socket.io signaling).
# Deploy: push to GitHub → render.com → New → Blueprint → pick this repo.
# It builds the whole monorepo and runs the apps/api workspace.
services:
  - type: web
    name: feater-api
    runtime: node
    plan: free
    region: singapore # pick the region closest to you
    buildCommand: npm install && npm --workspace apps/api run build
    startCommand: npm --workspace apps/api run start:prod # runs prisma migrate deploy, then starts
    healthCheckPath: /api/health
    envVars:
      - key: NODE_ENV
        value: production
      # Paste your Neon (or other managed Postgres) connection string here in the dashboard.
      - key: DATABASE_URL
        sync: false
      # Your Vercel URL(s), comma-separated, e.g. https://feater.vercel.app
      - key: CORS_ORIGIN
        sync: false
      - key: JWT_ACCESS_SECRET
        generateValue: true
      - key: JWT_REFRESH_SECRET
        generateValue: true
      - key: JWT_ACCESS_TTL
        value: 15m
      - key: JWT_REFRESH_TTL
        value: 30d
      - key: OTP_TTL_SECONDS
        value: "300"
      # Optional — real OTP email delivery (else use the seeded demo accounts):
      - key: SMTP_HOST
        sync: false
      - key: SMTP_PORT
        value: "465"
      - key: SMTP_USER
        sync: false
      - key: SMTP_PASS
        sync: false
      - key: MAIL_FROM
        value: "Feater <no-reply@feater.app>"
