{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
  buildInputs = with pkgs; [
    # Node.js ecosystem
    nodejs_24
    nodePackages.pnpm
  ];

  shellHook = ''
    FRONTEND_PATH=$(dirname ${toString ./.})
    cd $FRONTEND_PATH

    echo "Node.js development environment"
    echo "Node version: $(node --version)"
    echo "PNPM version: $(pnpm --version)"
    
    # Install dependencies if package.json exists
    if [ -f "package.json" ]; then
      echo "Installing npm dependencies..."
      pnpm install
    fi

    # Return to root directory
    cd -
  '';
}
