# Digital Ocean App Platform Spec
# Deploy VIP Coordinator from Docker Hub
name: vip-coordinator
region: nyc

# Managed Database (PostgreSQL)
databases:
  - name: vip-db
    engine: PG
    version: "16"
    production: false  # Dev tier ($7/month) - set true for prod ($15/month)

services:
  # Backend API Service
  - name: backend
    image:
      registry_type: DOCKER_HUB
      registry: t72chevy
      repository: vip-coordinator-backend
      tag: latest
      # For private repos, credentials configured separately
    instance_count: 1
    instance_size_slug: basic-xxs  # $5/month - smallest
    http_port: 3000
    health_check:
      http_path: /api/v1/health
      initial_delay_seconds: 40
    envs:
      - key: NODE_ENV
        value: production
      - key: DATABASE_URL
        scope: RUN_TIME
        value: ${vip-db.DATABASE_URL}
      - key: REDIS_URL
        value: ${redis.REDIS_URL}
      - key: AUTH0_DOMAIN
        value: dev-s855cy3bvjjbkljt.us.auth0.com
      - key: AUTH0_AUDIENCE
        value: https://vip-coordinator-api
      - key: AUTH0_ISSUER
        value: https://dev-s855cy3bvjjbkljt.us.auth0.com/
    routes:
      - path: /api

  # Frontend Service
  - name: frontend
    image:
      registry_type: DOCKER_HUB
      registry: t72chevy
      repository: vip-coordinator-frontend
      tag: latest
    instance_count: 1
    instance_size_slug: basic-xxs  # $5/month
    http_port: 80
    routes:
      - path: /

# Redis Worker (using official image)
jobs:
  - name: redis
    image:
      registry_type: DOCKER_HUB
      repository: redis
      tag: "7-alpine"
    instance_count: 1
    instance_size_slug: basic-xxs  # $5/month
    kind: PRE_DEPLOY
