Where to build your base[]
The best location for building your base is near multiple houses. The short distance from the house to the base makes it easier to farm sheet metal and electronic parts from the house. You should also consider building your base on the map border so that one side of your base is already covered up. You should try to avoid building your base inside houses because it will aggrivate other players who will try to kill you, and because it blocks access to computer parts for other players.
Building the base[]
Most bases are typically made of stone walls and in some cases metal if you have enough resources. Wood walls are discouraged because once the ghouls start chasing you, they will destroy them with ease. When starting a base, you should first place down some crafting tables and atleast one firepit. After that, focus on making stone walls/doors and wood/stone floors. If you want to build quicker, at level six unlock the builder 1 perk. This perk doubles the amount of your buildings for the same cost it would for a single one. A good tip is to have multiple entrances to your base so that it is more difficult for players to block you and to place floors on the outside of your base. You should make sure that your base large enough to fit multiple chests, a research bench, a smelter, a small farm (atleast 3x3), a tesla bench, and a fridge. An average base is about 10x15 squares.
Protection from ghouls[]
When it comes to defending against ghouls, there are two main ways of defense (assuming you haven't built your base in a house).
The first strategy is the repair bot strategy (aka lapabot strategy). This strategy is the most expensive but if done correctly, your base could be near indestructible to both players and ghouls. The strategy consists of placing repair bots along your walls and sealing them off with wooden slabs so that they stay in a stationary position. If you want a base that can withstand all types of ghouls, you should have atleast two repair bots for every three walls at the minimum. Be careful when placing them around doors to make sure you dont block yourself in. This strategy is best done if your base is near houses with a lot of computers (example The Internet Cafe). Make sure you craft a metal pickaxe to farm alloy materials. It is a good idea to build the Compost since it allows you to get rotten oranges more efficiently.
The second method is surrounding your base with as many walls as possible. This method requires alot of walls and doors, but once you get multiple layers of walls around your base it makes it longer for the ghouls to breach into the main part of your base. Every day you will have to replace the walls broken by ghouls if you want to have consistent protection.