Imagine this: you are having a good time exploring the world of Minecraft, but everything suddenly stops due to the sudden attack of a crowd of monsters. Zombies, endermen and creeps can easily ruin your game. To escape them, you can build a solid shelter in which you will be completely safe.
Steps

Step 1. To protect against zombies, replace wooden doors with iron doors or blocks

Step 2. Place torches or other lighting fixtures throughout the house to keep monsters from appearing inside

Step 3. Build walls around the house
To protect against spiders, build walls 3 blocks high, one block away from the walls of the house itself.

Step 4. Make a moat around the house
This will make the monsters stay away.

Step 5. Advice
You can lure monsters into the moat by placing several signs / drops under the outer edge.

Step 6. Build a tower from which you can spot monsters in time

Step 7. Build a bunker under the house, into which you can escape when attacking the house
Store there a supply of armor, weapons and food.

Step 8. The house should always have an emergency exit, preferably an underground one

Step 9. If you have enough redstone, build a drawbridge over the moat

Step 10. Advice
make sure the wires don't become a bridge over the moat for the monster.

Step 11. For more serious protection, you can build gateways that will help get rid of the endermen who teleported inside the house

Step 12. Always have one more base in stock

Step 13. Always remember the golden rule of PVE (player versus monster)
If you can't win, run! If your house is under attack, but all you have is a wooden sword and an empty stomach - run away, recuperate and look for new equipment.
Advice
- Keep your sword, food and armor with you at all times. Some might call you paranoid, but that's safer.
- Take care of the second base, where there will be a supply of armor, weapons and food.
- Monsters cannot spawn on tiles. If you can't light up the whole house, make a slab floor.
- Do not leave doors open - monsters can easily get inside.