Terbium doping of graphitic carbon nitride endows a highly sensitive ratiometric fluorescence assay of alkaline phosphatase.