National building codes call for the equipment to be a minimum of 5′ from the hot tub, or separated by a permanent solid barrier so that the distance from the water line, around the barrier, to the equipment is at least 5′.
The maximum distance is limited only by your imagination and individual requirements. 20′, 30′ or even 50′ from the hot tub to the equipment is perfectly acceptable.
The only downside to the equipment being a great distance from the hot tub is that if the system hasn’t run for a few hours the water in the pipes will have cooled down. Jumping in the hot tub, then turning on the pump, you’ll feel the cool water coming out of the jets.
This is easily overcome by turning on the pump a minute or so before entering the hot tub. Additionally, if the equipment is further than 40′ from the hot tub, the size of the piping should be increased one size so as to not cause a reduction in jet flow and pressure.