This paper proposes an optimization-based approach for designing rainwater harvesting systems for domestic use in a residential development. The optimization model accounts for the implementation of rainwater harvesting devices, pipes and reservoirs for the optimal sitting, collecting, storing and distribution of harvested rainwater. The optimization model consists in satisfying the water domestic demands and considers as objective function the minimization of the total annual cost associated to the fresh water, the capital costs for the catchment areas, storages and pumps, and the cost associated to the pumping, maintenance and treatment. A case study for a residential development in Morelia, Mexico is presented. The city of Morelia is characterized for having complications to satisfy the water demands, especially during dry seasons. The application of the proposed optimization approach shows that it is possible to satisfy a significant percentage of the domestic water demands using a harvesting rainwater system decreasing the associated cost in the time horizon. Several scenarios have been presented to show the potential solutions identified in the case study. (C) 2014 Elsevier B.V. All rights reserved.