First-principles theoretical results can predict and explain a variety of materials properties of the nitride semiconductors. For n-type GaN, we summarize the current understanding about incorporation of unintentional donor impurities, as opposed to nitrogen vacancies. For p-type GaN, we discuss the cause of the limited doping levels, and the role of hydrogen. We describe the role of gallium vacancies in the yellow luminescence, and the interaction between these vacancies and donor impurities. Finally, we discuss our first-principles investigations of the atomic and electronic structure of heterojunction interfaces between the III-nitrides, and provide values for natural band lineups.