Building the Base
The base of your bed foundation should be slightly smaller than the size of your mattress. This allows you to approach the mattress without stubbing your toe on the base. Measure your mattress; the average dimensions of a king-size mattress are about 80 inches by 76 inches. Subtract 6 inches from each side, and your completed base needs to measure 74 inches by 70 inches.
Construct your base from lumber that is 2 inches thick and as wide as you would like the height of your base to be; 2 by 8 lumber would work well. Create a basic frame like the one used for framing a wall: a square subdivided into three rectangular sections and reinforced using off-set cross braces for blocking. Use wood glue and 2.5 inch screws to attach the wood; drill pilot holes for your screws. Make sure the frame is completely level and perfectly square, and countersink the screw heads. Sand any rough edges.
Building the Platform
Construct the platform on which the mattress will rest in much the same way as the base, with some exceptions. First, the platform itself will be larger than the mattress. You can decide how much platform you want to show around the perimeter of the mattress. Second, construct the platform from 2 by 4 lumber. Use more cross braces for blocking. Again, make sure the platform you construct is completely level and perfectly square, and countersink the screw heads. Place the platform on top of the base, centering it accurately. Attach the platform to the base using screws and again drilling pilot holes. Attach medium-density fiberboard (MDF) to the top of the platform to cover it. Optionally, cover the underneath part of the platform that extends beyond the base with MDF.
Finishing and Options
Sand any rough edges that could damage your mattress or bed linens. Finish the bed frame as desired with paint or stain. Attach a headboard or footboard as desired, or leave the frame as is. For a four-poster bed, you can attach posters to the four corners of the bed; you can then finish the top as desired, with or without a canopy.
Other options include making the platform the same size as the mattress and including high sides to enclose the mattress. If you do not want a platform, create a base the size of the mattress and finish the top with MDF. If you have sufficient carpentry skills, you can install drawers into the base for additional storage.