Thousands of exoplanets have been discovered and the search for life outside Earth is at the forefront of astrophysical research. The planets we observe show a mind-blowing diversity that current theories strive to explain as part of the quest to assess the chances of finding life outside the Earth.