You really only need the width of the hoses but in my experience, giving yourself 6 to 8" of clearance helps very much in the future if you want to add something else. Also gives you room to clean if necessary. Giving yourself plenty of clearance lets you hang a temporary
HOB on the back if you ever want to clear cloudy water fast, or change the background, or add a shadowbox, etc.