Currently, most commercial membranes are used at temperatures below 50 °C. For high temperature water treatment, nanofiltration membranes with good thermal stability are highly sought after. In order to construct a novel polyamide thin-film composite nanofiltration (TFC NF) membrane, Congo red (CR) as monomer was introduced to the aqueous phase and the chemical structure of the selective layer was changed. Next, a thorough investigation was conducted into the impacts of the piperazine (PIP) to CR ratio on the surface morphology, separation efficiency and chemical structure of the membranes. The TFC NF membrane prepared after parameter optimization exhibited high retention (Na2SO4, >98 %) and flux up to 30 L·m−2·h−1·bar−1 at room temperature. Moreover, the Na2SO4 retention of the TFC NF membrane decreased by less than 1 % when used at 90 °C, demonstrating excellent heat resistance. Meanwhile, the incorporation of CR allowed the structure of the TFC NF membranes to be altered under UV irradiation conditions, which provided new insights into the optical modulation of the composite membrane properties. A promising and reproducible methodology for the development of high flux TFC NF membrane with thermal stability was offered, achieving a breakthrough in water treatment technology under high-temperature conditions.