Two-dimensional (2D) materials, whether pristine or defect-engineered, are promised as excellent candidates for the next generation of photodetector applications, due to their outstanding figures on optoelectmnics. However, reports are focused on homogeneous materials, rather than inhomogenous ones containing both pristine and defective areas. Herein, we demonstrate the boundary of pristine (SnSe2/graphene) and defective (SnSe2-x/graphene) 2D heterostructure generates the contact potential difference (CPD), leading to the unidirectional transport of photoexcited charges. Based on the defect boundary, we construct the self-powered photodetector with high performance, including a broadband photoresponse (450 nm similar to 1064 nm), high on/off ratio (up to 10(4)), fast response (20 mu s similar to 60 mu s), and high responsivity (0.076 A/W similar to 0.74 A/W). Moreover, utilizing the highly automated focused ion beam technology, periodic defect areas are patterned on the SnSe2/graphene hetemstmcture, forming 2D photodetector arrays with performance differences less than +/- 3%. This work reveals the mechanism of the unidirectional charge transport at the defect boundary and offers a novel avenue for the further development of cosmically 2D photodetector arrays.