  The effective attractive interaction between electrons, mediated by
electron-phonon coupling, is a well-established mechanism of conventional
superconductivity. In metals exhibiting a Fermi surface, the critical
temperature of superconductivity is exponentially smaller than the
characteristic phonon energy. Therefore such superconductors are found only at
temperatures below a few Kelvin. Systems with flat energy bands have been
suggested to cure the problem and provide a route to room-temperature
superconductivity, but previous studies are limited to only BCS models with an
effective attractive interaction. Here we generalize Eliashberg's theory of
strong-coupling superconductivity to systems with flat bands and relate the
mean-field critical temperature to the microscopic parameters describing
electron-phonon and electron-electron interaction. We also analyze the
strong-coupling corrections to the BCS results, and construct the phase diagram
exhibiting superconductivity and magnetic phases on an equal footing. Our
results are especially relevant for novel quantum materials where electronic
dispersion and interaction strength are controllable.
