Magnetic molecules have played a central role in the development of magnetism and coordination chemistry and their study keeps leading innovation in cutting-edge scientific fields such as magnetic resonance, magnetism, spintronics, and quantum technologies. Crucially, a long spin lifetime well above cryogenic temperature is a stringent requirement for all these applications. In this chapter we review the foundations of spin relaxation theory and provide a detailed overview of first-principles strategies applied to the problem of spin-phonon relaxation in magnetic molecules. Firstly, we present a rigorous formalism of spin-phonon relaxation based on open quantum systems theory. These results are then used to derive classical phenomenological relations based on the Debye model. Finally, we provide a prescription of how to map the relaxation formalism onto existing electronic structure methods to obtain a quantitative picture of spin-phonon relaxation. Examples from the literature, including both transition metals and lanthanides compounds, will be discussed in order to illustrate how Direct, Orbach and Raman relaxation mechanisms can affect spin dynamics for this class of compounds.