You can build almost anything you want in your backyard so long as you have the space and materials you need.
Just keep in mind that if you are putting in a shed, backyard office, treehouse, or other significant structure, you need to check the local building codes and the policies of your homeowner’s association. You might also want to talk with the people who live next door. Make sure that your structure is legal and will not cause trouble with your neighbors or HOA.