  A fundamental goal of microbial ecology is to understand what determines the
diversity, stability, and structure of microbial ecosystems. The microbial
context poses special conceptual challenges because of the strong mutual
influences between the microbes and their chemical environment through the
consumption and production of metabolites. By analyzing a generalized consumer
resource model that explicitly includes cross-feeding, stochastic colonization,
and thermodynamics, we show that complex microbial communities generically
exhibit a transition as a function of available energy fluxes from a
"resource-limited" regime where community structure and stability is shaped by
energetic and metabolic considerations to a diverse regime where the dominant
force shaping microbial communities is the overlap between species' consumption
preferences. These two regimes have distinct species abundance patterns,
different functional profiles, and respond differently to environmental
perturbations. Our model reproduces large-scale ecological patterns observed
across multiple experimental settings such as nestedness and differential beta
diversity patterns along energy gradients. We discuss the experimental
implications of our results and possible connections with disorder-induced
phase transitions in statistical physics.
