Polarons are among the most well-known quasiparticles in solid state physics, and are key to understanding fundamental concepts such as the electron mass enhancement in semiconductors and the formation of Cooper pairs in superconductors. Polarons attracted considerable attention ever since the concept was formulated by Landau a century ago. During the past decades significant progress has been achieved in the numerical solution of model Hamiltonians describing polarons, however first-principles calculations are still scarce. This lag is probably due to some practical as well as fundamental challenges, namely that explicit DFT calculations of polarons require very large supercells; that polaron self-trapping might be missed due to the DFT delocalization problem; and that the polaron binding energies can be very sensitive to the choice of the exchange and correlation functional. In this talk I will describe a new approach to the polaron problem that aims at overcoming these limitations [1,2]. Our strategy is inspired by the analogous problem of calculating excitons using the Bethe-Salpeter equation. Excitons can be delocalized over many crystal unit cells, but the underlying Bethe-Salpeter equation requires only information about DFT Kohn-Sham wavefunctions and Coulomb matrix elements within a single crystal unit cell. In the same spirit, in this work we reformulate the calculation of polarons via DFT as the solution of a coupled non-linear system of equations. The ingredients of such equations are computed in the primitive unit cell using from density-functional perturbation theory. By solving these 'polaron equations' we obtain the wavefunction, the lattice deformation, the formation energy, and the spectral decomposition of the self-trapped state into the underlying Bloch states and phonon modes. In order to demonstrate this methodology I will discuss a few case studies including large and small polarons, and show that even in the simplest crystals the structure of polarons is considerably richer than previously thought. [1] W. H. Sio, C. Verdi, S. PoncĂ©, and F. Giustino, Phys. Rev. Lett. 122, 246403 (2019). [2] W. H. Sio, C. Verdi, S. PoncĂ©, and F. Giustino, Phys. Rev. B 99, 235139 (2019).