How many turrents do you build? You may find that turrents act as more of a deterrent than hanger bays. I focus on repair bays and turrents first. As a matter of fact I've not built hangers at all lately.
Here's a thread about playing against the AI that I've found useful.
https://forums.sinsofasolarempire.com/341840
Pre-entrechment, this is pretty much the idea for deterring fleets. Against a real fleet, an extra 10-15 fighters are going to get chewed up fast when the opposing will most likely field 20+ fighter squadrons + bombers. Add in the fact that the fleet can easily focus on your hangars to shut down your fighters permanently. On the other hand 20-25 turrets with repair bays can take a long time to kill with their high hp and armor. I think vasari turrets have the best ability to actually take down ships due to their phase missles, but the TEC last the longest with their higher armor and better repair bays. Advent also get 8 more tatical slots so that's good too. Ultimately though, no defense in normal SOASE can stop a fleet. I recommend getting phase jump inhibitors on front line planets so when you do have a fleet arrive to defend and it can defeat the invading fleet, you can keep them there long enough to do some damage before they leave.
If you do get entrenchment in the future, that would really help alot defensively and in AI games I find it really changes the gameplay quite a bit. A upgraded vasari starbase with turret and repair bay support can really rip a hole in a fleet.