version: '3.9'
services:
  postgres:
    image: postgres:15
    environment:
      POSTGRES_DB: br_office
      POSTGRES_USER: br_app
      POSTGRES_PASSWORD: change_me
    ports: ["5432:5432"]
    volumes:
      - pgdata:/var/lib/postgresql/data

  frontend:
    image: node:20
    working_dir: /app
    command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
    volumes:
      - ./frontend:/app
    ports: ["5173:5173"]
    environment:
      VITE_API_BASE_URL: http://localhost:8080/api

  backend:
    image: node:20
    working_dir: /app
    command: sh -c "npm install && npm run dev"
    volumes:
      - ./backend:/app
      - ./data/uploads:/app/uploads
    ports: ["8080:8080"]
    environment:
      DATABASE_URL: postgres://br_app:change_me@postgres:5432/br_office
      CORS_ORIGIN: http://localhost:5173
      RP_ID: localhost
      RP_ORIGIN: http://localhost:5173
      JWT_ACCESS_SECRET: change-me-access
      JWT_REFRESH_SECRET: change-me-refresh
      COOKIE_SECURE: "false"
      UPLOAD_DIR: /app/uploads
      FILE_ENCRYPTION_ENABLED: "true"
      FILE_ENCRYPTION_KEY: please-change-this-encryption-key
      SMTP_HOST: smtp.example.com
      SMTP_PORT: "587"
      SMTP_USER: smtp-user@example.com
      SMTP_PASS: please-change-this-password
      SMTP_FROM: BR Office <noreply@example.com>
      SMTP_SECURE: "false"
      SMTP_REQUIRE_TLS: "true"
      FORCE_MFA_FOR_PRIVILEGED: "false"
    depends_on: [postgres]

volumes:
  pgdata:
