Generally if you have a large stream of ships coming into your homeworld, you're in big trouble. Generally if that large stream of ships reaches your forcefields, you're going to die unless you have some amazing defenses already lined up. It's kind of like having your king cornered in Chess -- you can get out of that, sure, but it's darn hard and not always possible.
I try to hold those ships at the wormhole with lots of tractors if I have some warning they are coming, and then have lots of turrets and stuff to kill them there. If they are the type that can't be tractored, or there are too many, then I line the path from the wormhole to my command station with tons of minefields. Even better is doing that on a planet outside of your home planet so that they never actually reach your home planet, but if this was a massive CPA that's not always possible.
The last option if there's a ton of stuff headed for your home and you have no way to stop it is to use some sort of warhead -- a nuke to kill the whole planet of them if they aren't mark V enemies, or an EMP to pause them so that you can shoot them. Other strategies like keeping a ton of spider turrets on your homeworld all in a giant ring around the outside of your planet is something that can really help, too.
Hope that helps!