AimsPeriprosthetic joint infection (PJI) is one of the most serious complications after total joint arthroplasty (TJA) but the characterization of the periprosthetic environment microbiome after TJA remains unknown. Here, we performed a prospective study based on metagenomic next-generation sequencing to explore the periprosthetic microbiota in patients with suspected PJI.MethodsWe recruited 28 patients with culture-positive PJI, 14 patients with culture-negative PJI, and 35 patients without PJI, which was followed by joint aspiration, untargeted metagenomic next-generation sequencing (mNGS), and bioinformatics analysis. Our results showed that the periprosthetic environment microbiome was significantly different between the PJI group and the non-PJI group. Then, we built a “typing system” for the periprosthetic microbiota based on the RandomForest Model. After that, the ‘typing system’ was verified externally.ResultsWe found the periprosthetic microbiota can be classified into four types generally: “Staphylococcustype,” “Pseudomonastype,” “Escherichiatype,” and “Cutibacteriumtype.” Importantly, these four types of microbiotas had different clinical signatures, and the patients with the former two microbiota types showed obvious inflammatory responses compared to the latter ones. Based on the 2014 Musculoskeletal Infection Society (MSIS) criteria, clinical PJI was more likely to be confirmed when the former two types were encountered. In addition, theStaphylococcusspp. with compositional changes were correlated with C-reactive protein levels, the erythrocyte sedimentation rate, and the synovial fluid white blood cell count and granulocyte percentage.ConclusionsOur study shed light on the characterization of the periprosthetic environment microbiome in patients after TJA. Based on the RandomForest model, we established a basic “typing system” for the microbiota in the periprosthetic environment. This work can provide a reference for future studies about the characterization of periprosthetic microbiota in periprosthetic joint infection patients.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12879-023-08390-x.