Assuming that you match the impedance of the patch to that of the feedline for maximum return loss (minimum VSWR), then it does not matter what the length of the feedline is and you can choose this to suit your application. If you are building the antenna on a circuit board it might be a good idea to make the feedline long enough so that your cable connector or feed circuitry is not interacting with the patch. So, perhaps making the feedline at least half as long as the patch side dimension would be good, and anything longer than this is fine too as long as you realize that adding unnecessary length adds unnecessary losses. If you plan to use the feedline as a resonant structure to match impedances (which is more unusual), then the length will depend on your match design.
The dimension of the substrate for the feedline, assuming it is all made on the same pcb substrate, will be the same as the substrate thickness for the patch. The patch design should determine this since the transmission line will work with any reasonable thickness of pcb substrate as long as the width of the feedline is adjusted to this thickness.
The box should be made of non-conducting material, like plastic, and should be kept roughly lambda/4 from the front and sides of the patch. There are no problems with the box coming close to the pcb in areas away from the patch.