This way you are protected from all sides at all times.
Each box consists of a floor and three walls around you. Once you have built a box, simply edit the front wall and create the next box behind it. This way you are protected from all sides at all times.