  We develop an analytical theory for generic disorder-driven quantum phase
transitions. We apply this formalism to the superconductor-insulator transition
and we briefly discuss the applications to the order-disorder transition in
quantum magnets. The effective spin-1/2 models for these transitions are solved
in the cavity approximation which becomes exact on a Bethe lattice with large
branching number K >> 1 and weak dimensionless coupling g << 1. The
characteristic features of the low temperature phase is a large self-formed
inhomogeneity of the order-parameter distribution near the critical point
K_{c}(g) where the critical temperature T_{c} of the ordering transition
vanishes. Near the quantum critical point, the typical value of the order
parameter vanishes exponentially, B_{0}\propto e^{-C/(K-K_{c}(g))}.
  In the disordered regime, realized at K<K_{c}(g) we find actually two
distinct phases characterized by different behavior of relaxation rates. The
first phase exists in an intermediate range of K^{*}(g)<K<K_{c}(g). It has two
regimes of energies: at low excitation energies, \omega<\omega_{d}(K,g), the
many-body spectrum of the model is discrete, with zero level widths, while at
\omega>\omega_{d} the level acquire a non-zero width which is self-generated by
the many-body interactions. In this phase the spin model provides by itself an
intrinsic thermal bath. Another phase is obtained at smaller K<K^{*}(g), where
all the eigenstates are discrete, corresponding to full many-body localization.
These results provide an explanation for the activated behavior of the
resistivity in amorphous materials on the insulating side near the SI
transition and a semi-quantitative description of the scanning tunneling data
on its superconductive side.
