services:
  - type: web
    name: eene-dashboard-backend
    runtime: node
    rootDir: backend
    buildCommand: npm install --include=dev && (npx prisma migrate deploy || true) && npx prisma db push && npx prisma generate && npm run build
    startCommand: npx prisma db push && npm start
    # 첨부 파일이 재배포 후에도 유지되도록 영구 디스크 (Render 유료 플랜 필요)
    disk:
      name: uploads-data
      mountPath: /opt/render/project/src/backend/uploads
      sizeGB: 1
    envVars:
      - key: DATABASE_URL
        sync: false   # Render 대시보드에서 직접 입력
      - key: PORT
        value: 4000
      - key: FRONTEND_URL
        sync: false   # Vercel 배포 후 주소 입력
      - key: JWT_SECRET
        generateValue: true
      - key: JWT_EXPIRES_IN
        value: 7d
      - key: UPLOAD_DIR
        value: /opt/render/project/src/backend/uploads
      - key: MAX_FILE_SIZE_MB
        value: 20
      - key: NODE_ENV
        value: production
