BackgroundFermented foods are considered to be beneficial for human health. Secondary metabolites determined by biosynthetic gene clusters (BGCs) are precious bioactive compounds with various biological activities. However, the diversity and distribution of the biosynthetic potential of secondary metabolites in global food fermentations remain largely unknown. In this study, we performed a large-scale and comprehensive investigation for the BGCs in global food fermentations by metagenomics analysis.ResultsWe recovered 653 bacterial metagenome-assembled genomes (MAGs) from 367 metagenomic sequencing datasets covering 15 general food fermentation types worldwide. In total, 2334 secondary metabolite BGCs, including 1003 novel BGCs, were identified in these MAGs. Bacillaceae, Streptococcaceae, Streptomycetaceae, Brevibacteriaceae and Lactobacillaceae contained high abundances of novel BGCs (≥ 60 novel BGCs). Among 2334 BGCs, 1655 were habitat-specific, originating from habitat-specific species (80.54%) and habitat-specific genotypes within multi-habitat species (19.46%) in different food fermentation types. Biological activity analysis suggested that 183 BGC-producing secondary metabolites exhibited high probabilities of antibacterial activity (> 80%). These 183 BGCs were distributed across all 15 food fermentation types, and cheese fermentation contained the most BGC number.ConclusionsThis study demonstrates that food fermentation systems are an untapped reservoir of BGCs and bioactive secondary metabolites, and it provides novel insights into the potential human health benefits of fermented foods.Video AbstractSupplementary InformationThe online version contains supplementary material available at 10.1186/s40168-023-01536-8