This work is mainly devoted to the study of a family of compact stars representing anisotropic fluids in the background of alternate gravity. In this paper, we obtain a solution for a new class of anisotropic configuration satisfying the embedding Class 1 Karmarkar condition. We conducted the investigation with the help of \(f(\mathcal {R},\mathcal {T})\) gravity theory, where \(\mathcal {R}\) and \(\mathcal {T}\) denote the Ricci scalar and the energy momentum tensor, respectively. By considering the compact stars to be static and spherically symmetric and with equally distributed anisotropic matter in them, the relation between the metric potentials \(\textrm{e}^{\nu }\) and \(\textrm{e}^{\mu }\) is obtained satisfying the Karmarkar condition. It has been observed that our model is well-mannered (i.e., the model is well-structured and well-behaved, satisfying all the necessary conditions for a stable structure and ensuring regular, smooth, and physically consistent behaviour) and dealt with every requirement for a stable structure in hydrostatic equilibrium for compact stars, namely PSR B1913 \(+\) 16, Cyg X-2 and PSR J1614-2230 for different values of \(\zeta \) , to a great extent.