We wanted to add night stands to our fifth wheel but the available space was at most six inches on each side. If I attached a shelf to the walls I was concerned that they would make changing the sheets difficult, so I made them removable. I bought 1x4x4ft half inch thick red oak at Lowes. The part that slides under the mattress is 21.5 inches long the upright is 10 inches long, the top/shelf is 16 inches long. The top was rounded over with a 1/4 inch round over bit in a router all parts have sharp corners removed so as not to snag the mattress. The upright is attached with two drywall screws and glue
The top is attached with glue only
I used minwax stain and polyurethane.
It should work out for us.