This dissertation reports the development of a optimization model to help designing a tri-generation system for a given newly-built district with its consumers to satisfy the heating, cooling, and hot water demands featuring 4th generation district energy characteristics. The aim is to find the best way to select the equipment among various candidates (capacities), the pipeline network among the buildings, and their electrical grid connections. The objective function includes the annualized overall capital and operation costs for the district along with the benefits of selling electricity to the grid. The distributed energy supply consists of heating, cooling, and power networks, different CHP technologies, solar array, chillers, auxiliary boilers, and thermal and electrical storage. The performance of the model was evaluated for designing two different case under various scenarios: (i) a combined heat and power design, and (ii) a combined cooling and power design both carried out for the new part of Suurstoffi district situated in Risch Rotkreuz, Switzerland with seven residential and office complexes. For the combined heat and power design, the scenarios are defined based on the existence or non-existence of the distribution network (both heat and electricity) and the effectiveness of the storage systems. Allowing heat exchange among the buildings leads to 25% reduction in the total annualized cost and 5% reduction in emission compared to the conventional districts. Simultaneous heat and electricity exchange results in a higher reduction equal to 40% of the base scenario. Adding storage systems opens up an opportunity to lower both costs and emission even more and turns the district to a net-zero energy and energy plus districts. For the combined cooling and power design, the effectiveness of the network is analyzed together with the potential of feeding absorption chillers using the heat from the solar and non-solar energy sources. More than 67% of CO2 emission reduction is achieved through the hybrid heat and solar-driven arrangement.