Dual purpose microalgae-bacteria-based systems that treat wastewater and produce biodiesel and chemical products within a biorefinery.