A foundation can be crafted from the crafting menu and takes 7x pile of planks in your inentory to build.
When you place and build a foundation it is a level 1 foundation. If you want to add a wall , a window or a door , you need to upgrade the foundation to at least level 2.
Upgrading to a next level takes 5x pile of planks . The final level is 3, which adds a roof.
Foundations can be linked together. You can not link to the foundation of another player unless you are in the same clan . Foundations can also be stacked on top of eachother.