Turret Composition

The first step to planning your defense is deciding on turret composition. Ideally, your turret composition will stop any attacker, no matter what unit composition they use. So having a mix of different turret types is key.

For example, beamers and flamers are both great, but if you only build those, your base becomes very vulnerable to raptors. So look at each unit type and make sure you have a good defense against that unit type. See the Turret Counters Table to understand the best turrets to defend against certain unit types.

Tip: When someone attacks you, you can watch the replay. If they succeeded, you can learn about the weaknesses of your base by seeing what units they attacked with (and how they approached your base). For example, if you are being attacked a lot by tactical swarm, you may need to change up your turrets to add more turrets that counter tacticals (e.g. bolters, plasma).

Certain turrets are objectively better/worse than others.

The best turrets are:

Bolter
Bolters are all-around fantastic, especially at the higher levels. They work very well against infantry and raptors. They are also cheap so you can get a lot of them for your turret points (TP).

Beamer
Beamers work best against heroes and glaives. They can also slaughter tacticals at long range (due to their explosive after-shock). Beamers can become a deadly force against your base when dominated. For this reason, it's best to deploy a few beamers or none at all. That way even if 1-2 of them are dominated, you still have some working for you. Also your opponent will quickly run out of energy if they try to keep multiple beamers dominated over time.

Flamer
Flamers are good against infantry and great against bikes. You'll definitely want to mix a few flamers in to stop these very common unit compositions.

Hunter
Hunters are an underrated turret that work great against almost any unit. They are only weak against tacticals (since they can't kill them fast enough) and glaives (since the glaives outrange them).

Other good turrets include:

Multi-melta
Multi-meltas are great against heavy vehicles but mediocre against anything else. They are fairly cheap so mixing a few in doesn't hurt.

Tanglefoot
Tanglefoots work really well at slowing down infantry but are useless against vehicles. They also reveal stealth units.

Graviton
Gravitons work really well against vehicles but are useless against infantry. Also, beware your opponent doesn't use them against you (by dominating them). Make sure the building closest to your graviton is a building you don't mind losing (e.g. a power storage) as that will be the first thing to go if it is dominated. Tip: never put a graviton next to your HQ.

Plasma
Plasma are good against light infantry and bikes but nothing else. The key to a good plasma is good placement. More on this later.

Whirlwind
Whirlwinds are great against light infantry (tacticals/support) and raptors but nothing else. Avoid deploying a lot of whirlwinds as even a few can take out an army of raptors and they cost a lot of TP.

Void Shield
Void Shields are very good at protecting key buildings from tactics. For example, if you are defending with Dray or BroZ, a scriptorum placed inside a VSG can ensure your hero will not be drawn out early. Likewise, beamers/flamers under the VSG's shield can be deadly to a bike or glaive army since they can't easily be taken out/disabled. The problem is a VSG costs so much, you need to compromise your base's defenses in a lot of other ways to afford it.

Some turrets are mediocre at best:

Lascannon
Lascannons are good against predators, dreadnoughts and heroes. But not much else. If you are getting hit with this dread+pred a lot, consider multi-melta instead. They are all-around better and cost 40 instead of 50 TP.

Volkite
Volkite cannons don't do enough damage to warrant the TP. They attack in a line, but units tend not to be lined up like that, so in practice they only attack a few units at a time anyway.

Mortar
Mortars are pretty much useless. While they can weaken/take out a few tacticals with one shot, they fire so slowly it doesn't matter. And their attack is often avoided entirely if your opponent's units are moving.