Due to the increasing share of battery electric buses (BEBs) in cities, depots need to be adapted to the increasing load demand. The integration of renewable energy sources (RESs) into a depot can increase the self-consumption, but optimal sizing is required for a cost-efficient and reliable operation. Accordingly, this paper introduces a co-design optimization framework for a depot microgrid, equipped with photovoltaics (PVs) and an energy storage system (ESS). Three European cities are considered to evaluate the effect of different environmental conditions and electricity prices on the optimal microgrid design. Accurate models of the different subsystems are created to estimate the load demand and the power generation. Different energy management strategies (EMSs), developed to properly control the power flow within the microgrid, are compared in terms of operational costs reduction, one of which was also experimentally validated using a hardware-in-the-loop (HiL) test setup. In addition, the total cost of ownership (TCO) of the depot microgrid is analyzed, showing that an optimally designed depot microgrid can reduce the charging-related expenses for the public transport operator (PTO) by 30% compared to a scenario in which only the distribution grid supplies the BEB depot.