We report a facile and direct fabrication method for integrating functional optical microstructures on the top surface of an optical fiber. A programmable maskless fabrication system was developed by using digital micromirror device (DMD), which allows rapid prototyping and low-cost fabrication without physical photomask. This maskless UV exposure system has the spatial resolution of 2.2 mu m for an exposed area of 245 mu m x 185 mu m. Diverse optical microstructures were photolithographically defined on multimode fibers and a single mode optical fiber serially spliced with a coreless silica fiber segment. This method provides a new route for developing compact functional fiber-optic applications such as laser scanning, biosensing, or laser endomicroscopy. (C) 2017 Optical Society of America