Measure in 1 inch from both ends of a 37-inch plank on 1-by-6 lumber and mark a line across the 6-inch face on both ends. Measure down 1 inch from both sides of the lumber, and mark two lines that go from the end of the lumber plank to the line across the face of the plank. This makes a 1-inch-by-1-inch square marked out on each corner of the plank.
Cut out the squares from each corner of the plank on a table saw. This creates a protrusion on both ends of the plank, called a tenon, which will be mated with a hole, or mortise, on the leg of the bed.
Repeat steps 1 and 2 with another 37-inch plank of 1-by-6 lumber, and two planks of 77-inch lumber. The 77-inch planks are the bed side rails; the 37-inch planks are the end rails for a twin-sized bed.
Measure down 2 inches from the top of four planks of 20-inch 4-by-4 lumber (the legs), and mark a 4-inch-long line centered on two adjacent faces of each leg.
Cut out a 4-inch-long, 1-inch-wide mortise on each leg with a mortise machine, using the line you drew as a guide. There should be two mortises per leg.
Apply wood glue sparingly on the tenons of all the bed rails. Insert the tenons on the end rails into the mortises on a pair of legs, then insert the tenons of the side rails into the mortises on the adjacent faces of the bed legs, to form a rectangle. Push the rails all the way into the mortises, so that the tenons and mortises are fully mated.
Drill two pilot holes, sized for the shaft of 2-inch wood screws, through the inner corner of the leg into the mortise and tenon joint of the side rails, and into the mortise and tenon joint of the end rails. There should be four pilot holes per leg.
Fasten the side and end rails in place with 2-inch wood screws through the pre-drilled pilot holes.
Measure down 3 inches from the top edge of the side rails and position a 75-inch 1-by-1 lumber plank all the way along the side rails, for the support cleat of the bed slats.
Fasten the cleat to the rails with 1-1/2-inch wood screws driven every 5 to 6 inches along the length.
Space 30 planks of 40-inch 1-by-2 lumber, the bed slats, evenly across the bed frame with their ends on the slat cleat. There should be 1/2-inch of space between each bed slat.
Fasten the slats in place with 1-1/2-inch wood screws through each end of the slat into the cleat.
Hand-sand the bed using fine-grit sandpaper and a sanding block. Using an electric sander tends to sand away the fine wood quicker, leaving a wavy surface; hand-sanding generally avoids this.
Apply the wood conditioner to the bed frame as directed on the conditioner label. Pine absorbs stain unevenly, so using a wood conditioner first helps to give an even finish to your stain.
Apply wood stain to the bed frame as directed by the instructions on the wood stain can.