• g-C 3 N 4 /Nb 2 O 5 /HPEI/PES photocatalytic membrane was fabricated via phase inversion method • Addition of g-C 3 N 4 /Nb 2 O 5 to PES improved hydrophilicity and water flux • 0.3%-g-C 3 N 4 /Nb 2 O 5 /PES showed the highest photocatalytic degradation of tetracycline • Methoxyacetylene and 2,3-butadienoate were detected as the by-products from photodegradation of tetracycline Graphitic carbon nitride/niobium oxide (g-C 3 N 4 /Nb 2 O 5 ) heterostructure within a hyperbranched polyethyleneimine (HPEI) template was prepared via the in-situ hydrothermal method. This heterostructure was embedded for a polyethersulfone (PES) polymer matrix using the phase inversion technique and applied on the photodegradation of tetracycline pollutant in water. To determine the structural formation of the membranes Fourier transform infrared spectroscopy (FTIR) was used. The hydrophilicity, water flux and morphology of the fabricated nanocomposite were investigated using water contact angle and SEM techniques, respectively. The nanocomposite membranes showed improved hydrophilicity from 60° up to 48° as compared to pure PES (65°). Furthermore, adding the heterostructure to the PES matrix improved the morphological features of the nanocomposite membrane resulting in large macrovoids and reduced pore size. The performance, pathway and mechanism of the tetracycline photocatalytic degradation by the g-C 3 N 4 /Nb 2 O 5 /HPEI/PES photocatalytic membrane were investigated using liquid chromatography-mass spectrometry (LC-MS). Tetracycline, as an active pharmaceutical compound, was fragmented into seven innocuous by-products with 2,3-butadienoate and methoxyacetylene, appearing at 83m/z and 59 m/z respectively, being the most stable fragments. The tetracycline degradation efficiency of the 0.3% g-C 3 N 4 /Nb 2 O 5 /HPEI/PES photocatalytic membrane at pH 10 was the highest with 88% efficiency over 180 minutes of consecutive irradiations.