The miniaturization and flexibility are two trends of electronic/optoelectronic devices. However, traditional layer-to-layer device structures induce poor interface, complexity or high cost, hindering these trends. Novel device architectures fabricated by compatible manufacturing techniques are highly demanded for the next-generation electronics/optoelectronics to. Herein, we report a novel monolithic optoelectronic device fabricated by a laser direct writing method. The in-situ growth graphene is employed as lateral electrodes for flexible ZnS/SnO2 ultraviolet photodetectors. This in situ growth method provides good interfaces between the graphene electrodes and the semiconducting ZnS/SnO2 resulting in high optoelectronic performance. Moreover, the lateral electrode structure reduces the thickness of the devices, thus minimizing the strain and enhancing the flexibility of the photodetectors. The demonstrated monolithic fabrication is a simple and inexpensive method, showing a great potential for the development into roll-to-roll manufacturing of flexible electronics/optoelectronics.