The structure of biodegradable surfactants shaped the microbial community, antimicrobial resistance, and potential for horizontal gene transfer.