In this article, a new business model considering multiple stakeholders is proposed to develop a framework for third-party investment and future flexible retail electricity market in community microgrids. The proposed two-stage optimisation platform generates opportunities for multiple stakeholders to invest in the design of community microgrids, comprising multiple and different distributed energy resources such as renewable generation units, battery energy storage systems, and micro diesel engines, to minimize daily operational costs of the system. To proliferate the prosumers in retail energy markets as per the Office of Gas and Electricity Markets, United Kingdom, a peer-to-peer energy trading and energy management scheme is also proposed. The optimal sizing of urban and remote community microgrids are determined in stage-1, followed by their optimal operations to minimise the daily operating cost of the community system in stage-2. An improved version of the genetic algorithm is employed to optimise decision variables in both the stages. Different cases are investigated which show the tremendous potential of revenue generation for all stakeholders while effectively optimizing techno-economic operations of microgrids.