Lay two planks of 50-by-2-by-5 and two planks of 30-2-by-5 vertically in front of you on the work surface. These are the head legs and the foot legs of the twin-size bed respectively.
Measure up 20 inches from the bottom of each leg and mark a line across the 5-inch face of the lumber. Use this as your orientation for the top of the mortise in each leg. A mortise is a hole, usually square or rectangular, which is mated with a tenon, or protrusion, on the end of the lumber you want to join to.
Cut a 2-inch wide and deep mortise through each leg, centered on the 5-inch face using a mortise machine.
Lay two planks of 79-by-2-by-6-inch lumber oriented horizontally in front of you on the work surface. These are the bed rails.
Measure in two inches from each end of the rail and mark a line across the 6-inch face. Measure in two inches from each side of the rails and mark a line from the end of the rail to the line you marked across the face of the plank. This delineates a 2-inch long and wide section on each end of the rails, which will be the tenon for mating in the mortises on the legs.
Cut out the tenons on a table saw, so that there is a 2-inch thick, wide and long tenon on each end of the bed rails.
Lay the two head legs flat on the work surface, oriented vertically in front of you, with the mortise ends closest to you. Spread them 40 inches apart.
Glue a 40-inch plank of 2-by-4-inch lumber between the top of the legs, and another 30 inches up from the bottom of the legs. These are the headboard planks
Toe screw the headboard planks to the legs using two 2-inch nails through the end of the each headboard plank into the back of the legs. Toe-screwing is when you screw something together with the screw at an angle to the joint. This allows you to screw lumber together that may otherwise need very long screws if screwing straight, for example, you would need 6-inch screws to go through the side of the legs and into the ends of the headboard.
Glue a 40-inch plank of 2-by-4-inch lumber between the top of the foot legs as well, for the footboard of the bed. Secure with screws as you did the headboard planks to the head legs.
Lay the two bed rails oriented horizontally in front of you. Measure down two inches from the top of the long edge of the rail and glue a 75-inch plank of 1-by-1-inch lumber along the length of both the rails at this point. This is the slat cleats for the bed. Secure the cleats with 1 1/2-inch screws driven every 10 inches along the length of the cleats.
Stand the head and the foot of the bed upright, about 80 inches apart. Cover the tenons on the bed rails with carpenter’s glue and have a helper assist you inserting the tenons into the mortises on the head and foot bed legs. If needed, use a rubber mallet to help get the tenons into the mortises.
Check that the rails are at right angles to the legs using a carpenter’s square. Clamp the rails in place with G-clamps once happy with the positioning and let dry.
Drill a pilot hole through each side of the legs into the tenon inside the legs, then secure together with 2-inch screws through the pilot holes.
Evenly space 21, 43-inch slats across the bed rails, resting on the cleats. There should be approximately 1/2 inch between each one. Fasten the slats to the cleats with 1 1/2-inch screws through each end of the slat into the cleat to finish the bed.