You will want the frame to have 1/2 inch of space between the mattress with no one on it, and the frame boards. You can use a sheet of 1/2-inch plywood for the base of the frame, and you should use sturdy 4-by-4 posts to make the legs. Try to design the loft so that there is enough room under the bed for a desk and a small storage area, but not so high that it will be difficult to get in and out of. If you decide to make the base plywood into two sections for easier transporting, then be sure to put a 2-by-4 board in between the two sections as a brace.
Your loft bed will need at least one of the longest sides to be open so that you can put your desk under it, but be sure to put a diagonal support board across the other long side to strengthen the loft. Always use 2-by-4 boards as support boards. Put support boards along the shorter sides with spacing in between them so you can use them as a ladder to get in and out of the bed, and as a place to hang clothes. Supports placed along one of the long sides and on both of the shorter ends of the loft should be sufficient to stabilize your loft.
According to the Disney Family Fun website, federal law mandates that a child must be at least 6 years old before they can safely sleep in a loft. Create removable guards for your young child's loft that are at least 12 inches high. As the child grows older, you can remove the high railings and replace them with smaller railings. If you really planned ahead and the loft is big enough for your child to take to college with them, then you can eventually remove the guard rails completely.