version: "3.8"
services:
  database:
    image: postgres:15
    container_name: myapp_db
    environment:
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: mypassword
      POSTGRES_DB: mydatabase
    ports:
      - "5432:5432"
    volumes:
      - db_data:/var/lib/postgresql/data

  backend:
    build: ./apps/server
    container_name: myapp_backend
    ports:
      - "5000:5000"
    depends_on:
      - database
    env_file: ./apps/server/.env
    volumes:
      - ./apps/server:/app
      - /app/node_modules

  frontend:
    build: ./apps/client
    container_name: myapp_frontend
    ports:
      - "3000:3000"
    depends_on:
      - backend
    env_file: ./apps/client/.env
    volumes:
      - ./apps/client:/app
      - /app/node_modules

volumes:
  db_data:
