Part 3: where to build
You need enough sun to grow your vegetables and that usually means 6-8 hours of good sun per day. Almost no vegetable grows well in shade (mint is maybe one thing but even that I’ve found does much better with full sun) and almost everything you can think of at a farmers market needs a lot of sunlight. Do not get fooled by anything online; yes, lettuce can benefit from being in some shade in the summer but that normally means giving it 6-8 hours of sun instead of 12-14 hours of scorching sun. And just because a plant is growing in a spot doesn’t mean your vegetables will. Ferns will grow in full shade, azaleas can survive in partial shade, but your vegetables might not do well in those spots. Doing a survey of your yard:
Do the easiest part first: are there a lot of tall trees in the place where you want to plant your garden? If so, it’s probably not the best spot. You need the area to be nearly treeless.
Then see whether your house or other structures cast a shadow that is going to shade out your garden beds. You need to know which way is north (grab a compass if you need). This direction is important for you. For example, if you put a garden bed on the north side of a tall fence I think you might have issues getting enough sun on the entire garden bed (particularly in the fall and spring). But if you put the garden bed on the south side of a fence I feel pretty good that you will get enough sun (provided there are no other obstacles). The school garden I helped with was near some large pine trees only 15 feet away; but they were all to the north of the garden. They were not a concern and the garden did well. (this is all true because we live in the northern hemisphere.)
Then remember that the sunlight in your yard varies throughout the seasons. What is very shaded in December may get more sun in June as the sun travels further north in our hemisphere. The sunny backyard in winter will be shaded as the leaves grow. As winter nears, the sun is getting further south and will cast longer shadows. I say all this because if you survey your yard on 21 June when the sun is furthest north in the sky the spot may look very sunny, but as the fall and winter get closer your house might cast a shadow as the sun moves further south.
Your observations of your yard are the best guide. I watch the shade line on the north side of my house change a good 10 feet as the seasons come and go. I wouldn’t put a vegetable garden within 20 feet of that north facing wall.
Here are some considerations using my house as an example:
My backyard has four old-growth trees in it. It simply is not suitable for a garden. There is one sliver of land against the southern portion of the house that in the height of summer would probably get enough sun but this isn’t the entire growing season.
The west side of my house is not suitable. The house casts a shadow on that plot of land almost all day. (it’s always very obvious that it’s shaded because my grass grows well there).
The east side of my house is also not suitable. There are high trees in my neighbor’s yard that casts shadows. And it’s too small.
The front yard is north of the house meaning that the house is going to cast a shadow onto the yard. But if you get out from the house at least 20 feet you get beautiful amounts of sun. The house’s shadow won’t cast that far even on 21 December (furthest south point of sun) and I have all the sun I need.
There is no formula that I can give you to make sure you have enough sun; you need to observe your yard and how the sun moves (ideally in the spring, summer, and fall… making notes of the shadows). Filtered light or a boxed-in area squeezed next to the house right under the holes in the foliage is probably not going to get you what you desire.