One of the reasons for the slowness of the hydrogen evolution reaction (HER) is that the accumulation of hydrogen generated near the active site hinders the efficient HER. In this work, Ni-doped Ti 3 CNT x -coated nanoporous covalent organic frameworks (Ni-Ti 3 CNT x /COFs, abbreviated as NMXC) were prepared to improve the diffusion concentration gradient of hydrogen due to the nanoscale structure design. The doped Ni nanoparticles can improve the catalytic activity of the conductive Ti 3 CNT x MXene. The results show that in a 0.5 M H 2 SO 4 solution, the Tafel slope of Ni-Ti 3 CNT x /COF (the concentration of Ni in Ti 3 CNT x is 0.3%, abbreviated as N 0.3 MXC) is only 46.2 mV dec −1 . The current density only decreased by 7.8% after 18 h in the long-term stability test under simulated sunlight. Firstprinciples calculations show that the introduction of Ni significantly improves the catalytic activity (|ΔG H* | can be as low as 0.06 eV). At the same time, the calculation of hydrogen adsorption energy and molecular dynamics simulations show that the gradient of hydrogen concentration on the surface of the NMXC composite is significantly different, which is beneficial to the diffusion of generated hydrogen molecules. This kind of structural engineering can shed some light for studying gas/catalyst interfaces on the nano/microscale.