So I've been attacked a couple of times, rejigged my cities now though so should be much harder but a couple of lessons learnt that I thought I'd share.
Defences - The positive
If you've not built any yet and haven't been attacked yet, try building some. Each one defence building at full strength is actually 5 units not 1. Plus they are stronger than the equivalent credits of units. Level 1 Missile Turrets only costs 20 credits (same as 1 Corvette) but gives 5x16/16 in strength, the equivalent of 20 Corvettes for the cost of one.
The buildings don't seem to get destroyed, once defeated and you liberate your occupied astro they start to recover but very slowly.
Defences - The negative
They take 1 each of area and population, plus energy. So barracks etc will almost certainly need ultimately demolishing if you build them now
Strength is scaled upon your defences. If you've not been attacked yet its 100%, but after getting conquered it drops to 0 and only recovers at the rate of 1% per hour unoccupied. IE it will take 4 days & 4 hours upon removing an occupier before it recovers fully. At least this is free though.
The problem is that if you (like me) wait until you're attacked before building defences they're built at 0% strength and slowly rising, rather than 100% strength. New ones built after conquest are just as damaged as old ones! So build them sooner than later. I've built 1 each of Barracks, Laser and Missile Turrets and am about to start Plasma Turrets. Ultimately will demolish Barracks and Laser.
Farming
I was shocked at how many credits they took from me when I was conquered - over 700 in one attack alone. I don't know yet how the mechanics work, but those credits did not come from my treasury I'm pretty sure. So its well worth farming if you can it seems.