The process typically involves dissolving a surfactant in a solvent, where it spontaneously forms a specific nanostructure. A precursor material, often a metal salt or a silica source, is then added to the solution. The precursor condenses around the surfactant template, forming a solid material with the same structure as the surfactant assembly. After the solid material is formed, the surfactant is removed, usually by calcination or solvent extraction, leaving behind a porous nanostructure.