Hello. My name's Randy, and I'll tell you how to keep your village safe, and I'll also tell you how to attack/defend.
Keeping your village safe:
1) Traps. Bombs do very low damage, so I suggest putting them at the corners of your village or at weak spots in walls. Spring traps do higher damage, so use them to cover open spots in your walls. They're good for killing Giants. Giant Bombs do extremely high damage, but at 50,000 gold per bomb and a Max of 1 Giant Bomb, I would suggest no. A single troop can set it off.
2) Mortar. The most effective defense. Splash damage from the shell does a lot of damage. Put this in the center of your village to ensure maximum coverage. But on the downside: It has a weak spot(4 tiles). Any enemy within that weak spot can attack without fear of getting themselves killed. Archers are not recommended to attack Mortars because they stand away 5 tiles.
3) Town Hall. Put this