A novel methodology has been applied to generate a porous molecularly imprinted material for highly selective and sensitive recognition of Janus kinase inhibitor ruxolitinib (RUX). The porous material-based nucleobase-derivative functional monomer was developed by a photopolymerization method. The thymine methacrylate (ThyM) as a functional monomer was synthesized and copolymerized with 2hydroxyethyl methacrylate (HEMA) in the presence of ethylene glycol dimethacrylate (EGDMA) onto the glassy carbon electrode [glassy carbon electrode/molecularly imprinted polymer@poly(2hydroxyethyl methacrylate-co-thymine methacrylate), (GCE/MIP@PHEMA-ThyM)] for the first time. The presence of ThyM results in the functional groups in imprinting binding sites, while the presence of poly(vinyl alcohol) (PVA) allows to generate porous materials for sensitive sensing. The characterization of GCE/MIP@PHEMA-ThyM was investigated by Fourier transform infrared (FT-IR) spectroscopy, scanning electron microscopy (SEM), and impedance spectroscopy technique. Then, the porous MIP modified glassy carbon electrode was optimized with effecting parameters including removal agent, removal time, and incubation time to get a better response for RUX. Under well-controlled optimum conditions, the GCE/MIP@PHEMA-ThyM linearly responded to the RUX concentration up to 0.01 pM at the limit of detection (LOD) of 0.00191 pM. The non-imprinted polymer (NIP) was also prepared to serve as a control in the same way but without the template. The proposed method improves the accessibility of binding sites by generating the porous material resulting in highly selective and sensitive recognition of drugs in the pharmaceutical dosage form and synthetic human serum samples. (c) 2021 Elsevier B.V. All rights reserved.