{
  description = "Preact Linktree Application";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            nodejs_24
            npm-check-updates
            docker
            docker-compose
          ];

          shellHook = ''
            echo "Preact Linktree Development Environment"
            echo "Node.js version: $(node --version)"
            echo "npm version: $(npm --version)"
            echo ""
            echo "Available commands:"
            echo "  npm install    - Install dependencies"
            echo "  npm run dev    - Start development server"
            echo "  npm run build  - Build for production"
            echo "  docker build . -t preact-linktree - Build Docker image"
            echo "  docker run -p 8080:8080 preact-linktree - Run Docker container"
            fish
          '';
        };

        packages.default = pkgs.stdenv.mkDerivation {
          pname = "preact-linktree";
          version = "1.0.0";
          
          src = ./.;
          
          buildInputs = [ pkgs.nodejs_18 ];
          
          buildPhase = ''
            npm ci
            npm run build
          '';
          
          installPhase = ''
            mkdir -p $out
            cp -r dist/* $out/
          '';
        };
      });
}
