The exploitation of fossil fuels is undoubtedly responsible of environmental problems such as global warming and sea level rise. Unlike energy plants based on fossil fuels, energy plants based on renewable energy sources may be sustainable and reduce greenhouse gas emissions. However, they are unpredictable because of the intermittent nature of environmental conditions. For this reason, energy storage technologies are needed to meet peak energy demands thanks to the stored energy. Moreover, the renewable energy systems composing the plant must be optimally designed and operated. Therefore, this paper investigates the challenge of the optimal design and energy management of a grid connected renewable energy plant composed of a solar thermal collector, photovoltaic system, ground source heat pump, battery, one short-term thermal energy storage and one seasonal thermal energy storage. To this aim, this paper develops a methodology based on a genetic algorithm that optimally designs a 100% renewable energy plant with the aim of minimizing the electrical energy taken from the grid. The load profiles of thermal, cooling and electrical energy during a whole year are taken into account for the case study of the Campus of the University of Parma (Italy).