ORIGINAL: Raap
Optimally, you'll want a small one for every colony and larger ones for really important colonies(i.e. lots of population, rare resource, strategic location, etc).
This is a bit late saying this, but I take a little offense from you saying "optimally" about building one space port over every last colony. That's a massive waste of resources that doesn't have a thing to do with optimality, if you'll pardon me for nitpicking. One port per system is an argument that can be made but one per colony is just silly.
And for perspective, I tend to build one or two per sector and it works just fine. I have to be a bit more careful with retrofit waves and repairs can be a pain but eventually I'll have repair bots on anything worth keeping and it's not that hard to retrofit system garrison fleets one at a time. I also don't have resource problems, not even when the AI decides it wants to build 50 civilian ships at one port, and since I'm more than a bit paranoid about those kinds of bottlenecks, I really do like to build fewer but larger ports that cover a solid cluster of colonies.
Edit: And just to make it clear, no, I'm not "angry", I'm just very much in disagreement about something you called "optimal". Taking those things rather too seriously is an occupational hazard, I guess.