Actually you only need to defend planets within jump range from an enemy (or pirate) planet. If the planet is surrounded by "uncharted" planets (i.e., they have the grid pattern), or if the planet's behind my front lines, then I only leave a highest-possible level space station in orbit and at least a barracks and light factory on the ground (see below).
Select a planet, then look at the circle around it. Only charted planets within - or just on the edge of - that circle can possibly attack the planet, AND planets on a hyperspace route connected to it can attack it as well. Think of it a bit like the old board game "Risk"...pay attention to where you can be attacked and where you cannot, then focus your forces accordingly.
I only fortify planets that can be reached by my enemy. Mid-game it's usually one or two each of Corellian Corvettes and Nebulon-Bs (plus the station's garrison, of course), or more if it becomes a "trouble spot" (gets attacked often). At tech 3 I'll replace Nebulons with Assault Frigates.
On the ground I never leave any troops on any planet, EXCEPT on a planet I just captured up until the barracks and light factory are built, after which I move them off-world. Once my buildings are there, the garrisoned troops are always able to protect the planet surface. Here's what I build on the ground with the Alliance based on the number of slots available...
2 : Barracks, Light Factory
3 : Barracks, Light Factory, Mine
4 : Barracks, Light Factory, Heavy Factory, Mine
5 : Barracks, Officer Academy, Light Factory, Heavy Factory, Shield Generator
6 : Barracks, Officer Academy, Light Factory, Heavy Factory, Shield Generator, Turbolaser Towers
7 : Barracks, Officer Academy, Light Factory, Heavy Factory, Shield Generator, Turbolaser Towers, Mine
8 : Barracks, Officer Academy, Infiltrator Academy, Light Factory, Heavy Factory, Shield Generator, Turbolaser Towers, Mine
...and on one of the planets where it's allowed, I'll build a Hutt palace so I can hire bounty hunters to kill enemy heroes. My Empire build priority is the same, just replace "Infiltrator Academy" with "Advanced Factory".
With this mix of buildings on any planet, my garrisons alone are almost always able to defend it, and easily if I have a heavy factory present (for artillery).
The best part: Not leaving any units behind my front lines means that much stronger of an assault force.
edit: Switched priority of shield generators and turbolaser towers in build lists.