I'm playing on Normal difficulty, and the same thing has happened to me many times: Early on, after all of the races can "see" each other, I'm generally in the bottom-end of the power rankings within the game. If I don't get a chance to play the Pragmatic "No one will declare war on me for 50 turns" card, the top-ranked race will declare war on me. With the game still relatively new, I might have a general on all my colonies, and maybe 5 or 6 corvettes and a military academy, but there hasn't been enough time to build more than that. They show up with bigger fleets and better tech. If the planet withstands invasion, they simply keep showing up and destroying whatever ships I can put on to defend.
Then, usually, the next most powerful race will also declare war. With no defenses left, and income gone due to freighter routes being terminated with races I'm at war with, I also have no money, and no way to find a way back into the game. I feel I must be doing something basically wrong.
What is your strategy for surviving early game attacks?