  Cataclysmic variables (CVs) are binaries in which a compact white dwarf
accretes material from a low-mass companion star. The discovery of two planets
in orbit around the CV HU Aquarii opens unusual opportunities for understanding
the formation and evolution of this system. In particular the orbital
parameters of the planets constrains the past and enables us to reconstruct the
evolution of the system through the common-envelope phase. During this dramatic
event the entire hydrogen envelope of the primary star is ejected, passing the
two planets on the way. The observed eccentricities and orbital separations of
the planets in HU Aqr enable us to limit the common-envelope parameter $\alpha
\lambda = 0.45\pm 0.17$ or $\gamma = 1.77\pm0.02$ and measure the rate at which
the common envelope is ejected, which turns out to be copious. The mass in the
common envelope is ejected from the binary system at a rate of ${\dot m} =
1.9\pm 0.3\,\MSun/yr$. The reconstruction of the initial conditions for HU Aqr
indicates that the primary star had a mass of $M_{\rm ZAMS} =
1.6\pm0.2$\,\MSun\, and a $m_{\rm ZAMS} = 0.47\pm 0.04$\,\MSun\, companion in a
$a=25$--160\,\RSun\, (best value $a=97$\,\RSun) binary. The two planets were
born with an orbital separation of $a_a=541\pm44$\,\RSun\, and
$a_b=750\pm72$\,\Rsun\, respectively. After the common envelope, the primary
star turns into a $0.52\pm0.01$\,\MSun\, helium white dwarf, which subsequently
accreted $\sim 0.30$\,\MSun\, from its Roche-lobe filling companion star,
grinding it down to its current observed mass of $0.18\,\MSun$.
