# Render Blueprint — Node web service + managed PostgreSQL.
# NOTE: the `free` Postgres plan is DELETED after 30 days. For persistent data,
# change databases[0].plan to a paid tier (e.g. basic-256mb) in the Render dashboard.
databases:
  - name: qft-db
    databaseName: qft_support
    user: qft
    plan: free

services:
  - type: web
    name: qft-support-system
    runtime: node
    rootDir: backend
    buildCommand: npm install
    startCommand: node src/server.js
    envVars:
      - key: NODE_ENV
        value: production
      # Postgres connection (provided automatically by the managed DB above)
      - key: DATABASE_URL
        fromDatabase:
          name: qft-db
          property: connectionString
      - key: DB_SSL
        value: "true"
      - key: JWT_SECRET
        generateValue: true
      - key: JWT_EXPIRES_IN
        value: 7d
      - key: UPLOAD_DIR
        value: ./uploads
      - key: MAX_FILE_SIZE
        value: "104857600"
      # Cloudinary (resource uploads) — fill in the Render dashboard
      - key: CLOUDINARY_CLOUD_NAME
        sync: false
      - key: CLOUDINARY_API_KEY
        sync: false
      - key: CLOUDINARY_API_SECRET
        sync: false
      # Email notifications (optional) — fill in the Render dashboard
      - key: SMTP_HOST
        sync: false
      - key: SMTP_PORT
        sync: false
      - key: SMTP_USER
        sync: false
      - key: SMTP_PASS
        sync: false
      - key: MAIL_FROM
        sync: false
      - key: APP_URL
        sync: false
      # SMS notifications (optional, Africa's Talking) — fill in the Render dashboard
      - key: AT_USERNAME
        sync: false
      - key: AT_API_KEY
        sync: false
      - key: AT_SENDER_ID
        sync: false
