Initially, density functional theory (DFT) calculations were performed to study the effect of S vacancy and P doping on the electronic structures of ZIS. Figure 1a-c presents the projected density of states (PDOS) of perfect ZIS, ZIS with S vacancy, and ZIS with P doping, respectively. Compared with the perfect ZIS, the Fermi level (*E*F) of ZIS with S vacancy moves upward and is close to the bottom of the conduction band, implying *n*-type properties16,17. In contrast, the *E*F of P-doped ZIS shifts downward into the occupied states near the top of the valence band, introducing acceptor states, that is, *p*-type characteristics18,19. To probe the charge transfer process in the one-unit-cell ZIS with S vacancy and P doping, the charge density difference referenced to pristine ZIS was also studied (Fig. 1d, e). The results signify the appearance of an electron losing layer in the S vacancy area and an electron accumulation layer in the P doped area, forming a built-in electric field orientated from top to bottom. Meanwhile, this evidence makes it manifest that S vacancy is of *n*-type character, while P doping is of *p*-type character, which is consistent with the results of PDOS. Moreover, from Fig. 1d it is clear that the positive charges around the S vacancy mostly appear in the top two layers of atoms (Zn, S), whereas the negative charges near the P dopants mainly occur in the bottom two layers of atoms (S, In). As for the middle part, it can be regarded as a charge-change transition region. Based on this finding, the top two layer atoms can be determined to be *n*-type domains, and the bottom two layers of atoms can be defined as *p*-type domains, while the middle three layers of atoms with a smaller charge density difference can be defined as a *p*-*n* junction (Fig. 1f). Hence, it is theoretically feasible to construct a *p*-*n* junction in one unit cell. To further reveal the role of this unique structure in charge separation, the planar-averaged charge density difference of ZIS with S vacancy, ZIS with P doping (Supplementary Fig. 1), and ZIS with S vacancy and P doping were compared. As shown in Fig. 1e, the charge changes in each layer of atoms are more differentiated, and the peaks at the bottom are higher than those of ZIS with S vacancy in Supplementary Fig. 1b (the blue shading), while the peaks at the top are higher than those of ZIS with P doping in Supplementary Fig. 1d (the yellow shading). This powerfully corroborates the better rectification effect and the stronger built-in electric field of the one-unit-cell *p*-*n* junction, which would not only accelerate the electrons to the top layers but also facilitate the movement of holes to the bottom layers, thereby improving the overall charge separation efficiency.

In a typical synthesis, the ultrathin *n*-ZIS nanosheet arrays were prepared on fluorine-doped tin oxide (FTO) substrates through an accessible hydrothermal process (Fig. 2a). As determined by the inductively coupled plasma ‒ atomic emission spectroscopy (ICP-AES) analysis (Supplementary Table 1), it should be noted that the atomic ratio of Zn, In, and S in *n*-ZIS was 1:2.01:3.83, respectively, reflecting some S vacancies in the as-obtained *n*-ZIS, which was further demonstrated by Mott-Schottky analysis (Supplementary Fig. 2). Subsequently, the samples were obtained by PH3/Ar treatment at 400 °C for 1 min with different flow rate ratios of PH3/(PH3 + Ar) (Methods). According to the ICP-AES results, the atomic ratios of P/(Zn + In + S + P) were about 1%, 2%, 3%, 4%, and 5%, and these samples were denoted as *n*-ZIS-P1, *n*-ZIS-P2, *n*-ZIS-P3, *n*-ZIS-P4, and *n*-ZIS-P5, respectively. Scanning electron microscope (SEM) images (Fig. 2b, Supplementary Fig. 3a) reveal that the ordered and ultrathin nanosheet arrays are vertically aligned on the FTO substrates with their height approximately 1.2 µm. The effects of the flow rate ratios of PH3/(PH3 + Ar), reaction time, and reaction temperature on the morphology of *n*-ZIS-P were studied (Supplementary Fig. 3–5).

The X-ray diffraction (XRD) peaks are indexed to hexagonal phase ZIS without any impurity (Supplementary Fig. 6a). The Raman bands of *n*-ZIS-P2 and *n*-ZIS-P5 are slightly redshifted with respect to *n*-ZIS (Supplementary Fig. 6b), implying that P is incorporated into the lattice of *n*-ZIS. The high-resolution transmission electron microscopy (HRTEM) image of *n*-ZIS-P2 demonstrates that the in-plane *d*-spacing of 0.334 nm matches with that of the (100) planes of hexagonal ZIS (Fig. 2c), implying that there is no obvious change compared to *n*-ZIS (Supplementary Fig. 7a). In addition, the homologous fast Fourier transform (FFT) pattern indicates the [001] orientation of the *n*-ZIS-P2 nanosheets (Fig. 2d). Consequently, it was verified that *n*-ZIS-P2 was obtained with a relatively ordered atomic arrangement in the crystal lattice, whereas the distorted crystal structure was found for *n*-ZIS-P5 (Supplementary Fig. 7b). The transmission electron microscope (TEM) image shows the light contrast of the extremely thin two-dimensional nanostructure of the *n*-ZIS-P2 nanosheets (Fig. 2e). Furthermore, the lateral HRTEM image of *n*-ZIS-P2 shows seven atomic layers with the thickness of ~ 1.24 nm (inset in Fig. 2e). The estimated thickness was further corroborated by atomic force microscopy (AFM) to be 1.25 nm (Supplementary Fig. 8). Considering that the *c* parameter of ZIS is 12.34 Å, the thickness of *n*-ZIS-P2 is in agreement with the thickness of one-unit-cell ZIS along the [001] axis (Supplementary Fig. 9). The elemental mappings of a vertically standing *n*-ZIS-P2 nanosheet reveal that P is concentrated in a narrow region near In in the outermost atomic layers, while the distribution of the other elements closely matches the model of one-unit-cell ZIS (Fig. 2f). The atomic ratio of Zn, In, S, and P of *n*-ZIS-P2 was estimated to be 1:2.01:3.68:0.15, respectively, based on the energy-dispersive X-ray (EDX) spectrum (Supplementary Fig. 10) and ICP-AES analysis. X-ray photoelectron spectroscopy (XPS) confirmed that the P 2p signals of *n*-ZIS-P2 are at 129.9 eV and 130.5 eV for P 2p3/2 and P 2p1/2 (Fig. 2g), respectively, which could be attributed to P-In or P-Zn bonds20,21. The formation of P-Zn bonds can be excluded, however, considering that the binding energy of Zn 2p is almost unchanged (Supplementary Fig. 11a). The peak at 133.9 eV could be ascribed to the oxidized phosphorus species (P-O) caused by the surface exposure to air22. Moreover, the P doping has little effect on the concentration of cations (Supplementary Fig. 11a, b), in accordance with the ICP-AES results. As the doping concentration increases, however, the intensity of P 2p is enhanced, which is the mirror image of S 2p (Supplementary Fig. 11c). Collectively, it is reasonable to deduce that P atoms replaced S atoms to form P-In bonds, in line with the results of elemental mapping.

Ultraviolet-visible diffuse reflectance spectra (DRS) revealed a slightly red-shifted absorption edge of *n*-ZIS-P compared to that of *n*-ZIS (Supplementary Fig. 12a). In the corresponding Tauc plots, the obtained band gap (*E*g) value of *n*-ZIS-P2 (2.34 eV) is decreased by 0.04 eV with respect to that of *n*-ZIS (2.38 eV), suggesting that appropriate P doping would not affect the visible light harvesting too much. As the Mott-Schottky plot of *n*-ZIS-P2 shows (Fig. 3a), straight lines with positive and negative slopes in different potential regions are observed, indicating the presence of both *n*- and *p*-type properties in *n*-ZIS-P223. This implies that S vacancies and the introduced P successfully create *n*- and *p*-type domains in the *n*-ZIS-P2. The *E*F of *n*-ZIS-P2 was determined based on the abscissa intercepts of the extrapolated straight lines, and the symbols *E*Fn and *E*Fp denote the Fermi levels of *n*- and *p*-type conductivity domains, respectively. Notably, the *E*Fn of *n*-ZIS is almost the same as that of *n*-ZIS-P2 (Fig. 3a, Supplementary Fig. 2), implying that the *E*Fn of *n*-ZIS can represent that of *n*-ZIS-P2 to some degree24,25. Furthermore, the valence band maximum (VBM) energy level of *n*-ZIS-P2 was determined by linear potential scans 24,26, and the anodic scan result indicated a VBM value of around 1.30 eV versus RHE (Supplementary Fig. 12b). Correspondingly, the conduction band minimum (CBM) value can be calculated to be -1.04 eV versus RHE by the equation *E*CBM = *E*VBM − *E*g, where *E*g is the band-gap energy.

For further confirmation of the band structure of *n*-ZIS-P2, ultraviolet photoelectron spectroscopy (UPS) measurements were undertaken (Supplementary Fig. 12c, d). The cut-off energy (*E*cutoff) of *n*-ZIS and *n*-ZIS-P2 is 17.6 eV and 16.8 eV, respectively. while the *E*F values of both are controlled at 0 eV by contacts of the samples with gold. Accordingly, the work function (*Φ*) of *n*-ZIS can be calculated to be 3.62 eV versus vacuum by the following equation, *Φ* = *hv* - |*E*cutoff - *E*F|. Apparently, the *E*Fn (-0.88 eV versus RHE) of *n*-ZIS and the VBM (1.29 eV versus RHE) of *n*-ZIS-P2 obtained from the UPS data are very close to those of *n*-ZIS-P2, which were determined by electrochemical measurements, confirming the reliability of above results. In addition, the *E*F of *n*-ZIS-P2 (-0.08 eV versus RHE) determined by *E*cutoff is located between *E*Fn and *E*Fp. Based on the aforementioned results, the energy level diagrams of *n*-ZIS-P2 with the coexistence of *n*- and *p*-type characteristics are presented in Fig. 3b. Then the presence of *n*- and *p*-type domains would contribute to the construction of *p*-*n* junctions in one unit cell, in which the *E*F equilibrium is achieved, thereby forming a robust built-in electric field for charge separation/transfer (Fig. 3c). Taken together, these results reasonably manifest the successful construction of *p*-*n* junctions in one-unit-cell photocatalysts.

Figure 4a illustrates the PEC hydrogen production performance of various samples in aqueous solution containing 0.5 M Na2SO3 upon illumination by a solar simulator (1 sun at AM1.5G) at 1.23 V versus RHE. The *n*-ZIS-P2 adopted as a photoanode presents admirable activity and excellent photostability for the PEC reaction, delivering a remarkable hydrogen evolution rate of 130 µmol cm− 2 h− 1 on the counter electrode, which is roughly 26 times that of *n*-ZIS (Supplementary Fig. 13a). Furthermore, the robust stability of *n*-ZIS-P2 was further confirmed by XRD, SEM, TEM, and HRTEM characterizations of the sample after reaction (Supplementary Fig. 13b-d). These observations highlight that the appropriate incorporation of P into *n*-ZIS promoted the PEC activity, benefitting from the unique one-unit-cell *p*-*n* junction structure (Fig. 4b).

To shed light on the high performance of *n*-ZIS-P2, several spectroscopy characterizations were carried out. Steady-state photoluminescence (PL) spectroscopy was used to disclose the separation of photogenerated electron-hole pairs (Supplementary Fig. 14a). Clearly, the emission of *n*-ZIS-P2 was strongly quenched compared with that of *n*-ZIS, indicating that the recombination of carriers was forcefully suppressed in *n*-ZIS-P2. Moreover, surface photovoltage spectroscopy (SPV) indicated that the *n*-ZIS-P2 exhibited a higher SPV response intensity compared to *n*-ZIS (Supplementary Fig. 14b), which can be ascribed to the faster and more effective carrier separation of *n*-ZIS-P2. Time-resolved PL (TRPL) spectroscopy was used to investigate the charge carrier dynamics of the samples (Fig. 4c). The decay kinetics of *n*-ZIS-P2 (5.48 ns) exhibit a longer average lifetime than that of *n*-ZIS (1.98 ns), implying prolonged lifetimes of charge carriers27. On the basis of these findings, there is no doubt that the electron-hole separation/transfer efficiency can clearly be enhanced by creating *p*-*n* junctions in one-unit-cell *n*-ZIS layers, which would greatly promote PEC efficiency. Nevertheless, *n*-ZIS-P5 displays worse performance than *n*-ZIS-P2, suggesting that the distorted structure may introduce excessive recombination centers for electrons and holes, thus reducing its advantageous properties28.

To visually investigate the electron-hole separation/transfer properties of the samples, we carried on photodeposition experiments, in which photoreduced and photooxidized precipitates respectively emerge on the sites where photoinduced electrons and holes are located29,30. The SEM images of *n*-ZIS-P2 show that photodeposition of Pt and Ag merely takes place on one surface, while these nanoparticles are hardly found on the opposite surface (Supplementary Fig. 15a, b). Similarly, the MnO*x* and CoO*x* are oxidatively photodeposited solely on one surface (Supplementary Fig. 15c, d). Nevertheless, the intrinsic *n*-type characteristic and substantial recombination of electron-hole pairs in *n*-ZIS could only lead to a low amount of metal photodeposition (Supplementary Fig. 15e, f). To validate which surface of the nanosheets the nanoparticles are specifically deposited on, elemental mapping analysis was conducted (Supplementary Fig. 16). Pt prefers to deposit on the surface near Zn whereas MnO*x* tends to locate on the P-doped surface, demonstrating the respective accumulation of photogenerated electrons and holes at the corresponding surface. This further identifies the orientation of the built-in electric field created by the one-unit-cell *p*-*n* junctions, in agreement with the calculations. The chemical valence states of the deposited nanoparticles were confirmed by XPS characterization (Supplementary Fig. 17). The results reveal that the resultant Pt and Ag species are in metallic form, whereas the Mn and Co species are in oxidation states higher than those of the corresponding precursors. All these results unambiguously verified the key role of the one-unit-cell *p*-*n* junctions in contributing to the enhanced efficiency of charge separation/transfer.

Various electrochemical tests were also performed to clarify the enhanced PEC performance of *n*-ZIS-P2. The photocurrent-voltage (*J*-*V*) curves show that the *J* of *n*-ZIS-P2 reaches its highest value of 6.98 mA cm− 2 at 1.23 V versus RHE, an almost 11-fold increase from *n*-ZIS to *n*-ZIS-P2 (Supplementary Fig. 18a), demonstrating the enhanced photoactivity of *n*-ZIS-P2. Moreover, the rapid and reversible photocurrent responses were confirmed by photocurrent-time (*J*-*T*) curve measurements at 1.23 V versus RHE under chopped light irradiation (Fig. 4d), which can be attributed to the efficient charge separation. The long-term photocurrent measurements reveal that the *n*-ZIS-P2 could obviously remain stable for a longer time than *n*-ZIS (Supplementary Fig. 18b), suggesting high stability against photocorrosion. In addition, electrochemical impedance spectroscopy (EIS) was performed, and the Nyquist plots demonstrate that the arches for *n*-ZIS-P2 under illumination or in the dark are much smaller than those recorded for *n*-ZIS (Supplementary Fig. 18c, d), reflecting the accelerated interface charge transfer of *n*-ZIS-P2. As illustrated in Fig. 4e, the HC-STH efficiency for the *n*-ZIS-P2 photoanode reaches a maximum value of about 3% at 0.6 V versus RHE. To the best of our knowledge, the HC-STH efficiency that we report here for *n*-ZIS-P2 is the highest value among all the reported photoanodes with single-photon excitation (Supplementary Table 2). Additionally, the incident photon-to-electron conversion efficiency (IPCE) measurement demonstrates that *n*-ZIS-P2 photoanode displays a dramatically enhanced IPCE value, and the maximum IPCE value of about 78% is obtained at 365 nm (Fig. 4f), clearly revealing enhancement of the separation/transport efficiency in *n*-ZIS-P2. In the case of *n*-ZIS-P5, its depressed activities can be attributed to its severe electron-hole recombination, in the light of the spectroscopy results.