Minecraft wiki entry for Safe_home, associated text: Don't build out of wood. Yes, it looks nice, but it is fragile to explosions, flammable, and vastly more labor-intensive to produce as a building material, than other blocks. If you must use it, build three block thick walls, with a cobblestone core, and a wood facade as the outer two. If you are in multiplayer, someone could burn your house.
For general construction, cobblestone is ideal. It is easily obtainable, (via either mining or a cobblestone generator with lava and water, which can be constructed in the vanilla game) is non-flammable and impervious to ghast fire, and also has a decent resistance to explosions. Nether and stone brick are somewhat less plentiful, but more aesthetically pleasing alternatives, with the same defensive advantages as cobblestone. Obsidian is also an ideal choice, as it can resist explosions like TNT or creepers. However, obsidian is hard to find and pick up, as it requires a diamond or netherite pickaxe and lava, and is not very aesthetically pleasing.
Mines and underground passageways should be no wider than two blocks, to discourage mob spawning. Torches should also be placed at four block intervals.
Use a fence or a wall to keep all mobs except spiders and spider jockeys off your lawn. Though to keep spiders and spider jockeys out, just ring the top of your house with any block.
You can create iron golems to defend your territory. These metal wonders will deal lots of damage to any mobs that come near it. They can be very useful for defending small houses. Beware of the creeper though! Iron golems will not attack creepers.
Use a cactus fence built from two rows of cacti (like this: