We present how mesoporosity can be engineered in transition metal phosphate (TMPs) materials in a template-free manner. The method involves a transformation of a precursor metal phosphate phase, M-struvite (NH4MPO4·6H2O, M = Mg2+, Ni2+, Co2+, Nix2+Co1-x2+), and it relies on the thermal decomposition of crystalline M-struvite precursors to an amorphous and simultaneously mesoporous phase which forms while degassing of NH3 and H2O from crystals. The temporal evolution of mesoporous frameworks and the response of the coordination metal coordination environment were followed with in-situ and ex-situ scattering and diffraction, as well as X -ray spectroscopy. We highlight the systematic differences in absolute surface area, pore shape, pore size, and phase transitions depending on a metal cation present in the analogous M-struvites. In a complex amorphous structure, thermally decomposed Mg-, Ni- and NixCo1-x-struvites exhibit high surface areas and pore volumes (240 m²g-1 and 0.32 cm-3 g-1 for Mg and 90 m²g-1 and 0.13 cm-3 g-1 for Ni) for phosphate materials with a spherical to channel-like pore geometry. Despite sharing the same precursor struvite structure, different amorphous and mesoporous structures were obtained in the chemical systems. We propose that the low-cost, environmentally friendly M-struvites could be obtained as recycling products from industrial and agricultural wastewaters. These waste products could be then upcycled into mesoporous TMPs through a simple thermal treatment for further applications in (electro)catalysis.