An enormous flaw in Star Trek, that nobody to my knowledge has ever acknowledged, is the problems inherent in warp vessels being able to warp right up to the orbit of a planet. Sure, some planets have armadas of ships and sensor nets to keep out enemy ships, but even so, there's a pretty big problem there, in that even with long-range sensors, there are also cloaked vessels. Some would have you think the fact that cloaked vessels can't fire while cloaked and have no shields while cloaked is enough, but it's not. All it would take to end a war is one kamikaze pilot flying a cloaked vessel at warp speed right into a planet. You don't even need to impact the ground, or use a warhead; go fast enough when you smack into a planet's atmosphere, and you ignite the atmosphere. So how to win a war in the Star Trek universe? Just strap a warp drive and a cloaking device to an asteroid, point it at your enemy, and fire.
What the Trek universe needs to protect its planets is some kind of device that creates a subspace quagmire around a solar system that forces ships out of warp, so they have to use sublight/impulse to get from the edge of the solar system to any of the planets in that system.