Harmful algal blooms (HABs) found in various water bodies worldwide have been a huge concern due to their adverse impacts on human health and ecosystems. In particular, HABs associated with cyanobacteria have been of great interest because of their potential to generate and release biological toxins, especially, lethal microcystins (MCs). The overall goal of this study was to develop a new sustainable approach to decompose MCs, preferably on-site and in real-time with minimal effort, fewer chemicals, and low energy inputs. To achieve the goal, a high efficiency nitrogen-doped TiO2 photocatalytic film immobilized onto a glass substrate was fabricated via integrated sol-gel synthesis employing nitrogen-containing surfactants as pore-templating agent and nitrogen-dopant. The film exhibited visible light-activated, nanoporous, and transparent properties. Effects of surfactant type, calcination temperature, coating layers, and reaction pH on the photocatalytic decomposition of microcystin-LR (MC-LR) were investigated under visible light. Eventually, the TiO2 film was able to successfully decompose MC-LR on-site in a lake under solar radiation in real-time. This study implies the high potential of the TiO2 film for on-site and real-time decomposition of many organic contaminants in water by using sustainable solar energy.