Energy communities (EC) are expected to have a pivotal role to reach European decarbonization targets. One of the key aspects is the regulatory framework adopted by each Member State to properly manage such new customers’ aggregation. The paper firstly provides an updated overview of the EC regulation, focusing on the current Italian legislation. Next, a novel methodology for the design and management of energy community initiatives is proposed. The procedure firstly solves a design and operation optimization problem to calculate the best size of energy assets (boiler, heat pump, photovoltaic, thermal storage) to be installed. Second, a Shapley value-based approach is exploited to distribute a part of the community’s incomes to members, based on their contribution to the overall welfare. Results demonstrate that the adopted methodology is effective in ensuring a proper cash flow for the community, while pushing its members towards energy efficient behaviors.