version: '3.8'

services:
  # Backend API Server
  api:
    build:
      context: ./server
      dockerfile: Dockerfile
    container_name: dss-api
    ports:
      - "3001:3001"
    environment:
      NODE_ENV: development
      PORT: 3001
      DATABASE_URL: sqlite:./data/design-system.db
      JWT_SECRET: dev-secret-key-change-in-production
      JWT_EXPIRE: 7d
      JWT_REFRESH_SECRET: dev-refresh-secret-key
      JWT_REFRESH_EXPIRE: 30d
      CORS_ORIGIN: http://localhost:5173,http://localhost:3000
      LOG_LEVEL: debug
    volumes:
      - ./server/src:/app/src
      - ./server/data:/app/data
    networks:
      - dss-network
    restart: unless-stopped

  # Frontend Development Server (using existing Vite config)
  frontend:
    image: node:18-alpine
    container_name: dss-frontend
    working_dir: /app/admin-ui
    ports:
      - "5173:5173"
    environment:
      VITE_API_URL: http://localhost:3001/api
    volumes:
      - ./admin-ui:/app/admin-ui
    command: sh -c "npm install && npm run dev"
    networks:
      - dss-network
    depends_on:
      - api
    restart: unless-stopped

networks:
  dss-network:
    driver: bridge
