A junction box includes a housing that includes sidewalls and a bottom attached to the sidewalls. An exterior side of the bottom is configured to be mounted to a roof of a structure. The junction box includes a flashing attached to the housing and extending horizontally from the housing. The flashing is formed with the housing. The junction box includes a lid configured to be mounted a top edge of the sidewalls of the housing, where the top edge of the sidewalls is distal to the bottom, and one or more fasteners configured to retain the lid in proximity to the to the housing. The one or more fasteners are each inserted vertically though a hole in a top of the lid into the housing.