Distributed energy production by Solar Panels is really wide-spread today. However the mismatch between production and consumption during the day, and expensiveness of energy storages, limits an high rate of self-consumption. In fact the overall overproduction is currently reversed into the power grid and delivered to the energy provider. In this context the CoSSMic project aims at developing a distributed software architecture that allows for the collaboration among neighbors, both to schedule the consumptions and the exchange of energy, in order to maximize the self-consumption of micro grids. This paper focus on the architecture design, scouting of technology and preliminary demonstrator.