Building codes are the legal regulations that govern the design, construction, alteration, and maintenance of a structure or dwelling—including residential, commercial, and agricultural, as well as schools, churches, and garages.