Plant-associated microbiomes contribute to host phenotypes, including growth, productivity and disease resistance. Current research aims to elucidate the molecular basis by which host-microbe and microbe-microbe interactions shape and maintain microbial communities, and to understand the role of individual microorganisms and their collective ecosystem function. Reductionist approaches are discussed to disentangle the inherent complexity of interactions in situ. Such experimentally tractable, synthetic communities enable hypotheses to be tested through targeted manipulation in gnotobiotic systems. We study community assembly based on metabolic interactions among microbiota members and the relationships between the plant immune system and microbiota assembly and homoeostasis, with a focus on the phyllosphere. We found that both a functional immune system and the plant microbiota are necessary to maintain microbiota homeostasis, highlighting the critical role of the plant immune system in controlling microbiota assembly.