• Integrated optimization of charging infrastructure and charging scheduling. • A two-phase optimization framework is proposed to solve the integrated problem. • Uncertainties in bus energy consumption and vehicle travel time are considered. • A novel rolling horizon approach is proposed to tackle real-time charging scheduling. Studies on the electric bus system planning problem have typically focused exclusively on either the deployment of charging infrastructure or the scheduling of charging events; few have examined the impact of charging facility deployment on charging activities. Considering the interdependence of system design and operational strategies, this study proposes a two-phase optimization framework for charging infrastructure planning and charging scheduling for battery electric bus systems. An integrated optimization model is first developed to simultaneously optimize charger deployment, on-board battery capacity, and charging schedules. A charging scheduling model is further proposed and a rolling horizon approach is utilized in the second phase to optimize the real-time charging scheduling of electric buses. Compared to existing electric bus system planning methods, the proposed integrated model can reduce the total system cost by 19.5%. In addition, compared to uncontrolled charging, the proposed rolling horizon-based charging strategy can reduce the total charging cost by 68.3%.