Energy as well as water are two valuable resources that are majorly utilized in all sectors, from residential consumption to industrial processes. As conservation of resources are becoming a priority, optimization of energy or water system for residential and industrial usage is becoming more important. Previous optimization problems solved using Pinch Analysis only focused on optimization of single resource which may lead to under-sizing of system, as systems may rely on one another to operate. By using pinch analysis, it lacks the capability to consider other variables such as cost in its analysis. As such, a MILP model is developed in this study to provide a more holistic approach to the optimization problem. A case study comprising of both electricity and water demand of 6,875 kWh and 3,000 m3 from a residential area with 1,000 unit of houses is applied in this work. The electricity demand is met using fuel cell where hydrogen is produced through coal gasification (which utilised water as it raw material), a water treatment plant (WTP) is also introduced for water treatment to fulfil the water demands. The results revealed the capacity of the system is larger compared to the similar case study done using pinch analysis. The resulting cost of the system is MYR 516,650,000.00. Apart from identifying the optimal capacity and cost of the system, the study concluded that the higher the interdependency of resources, the differences become more significant. When analysing system that shows an inter-dependent or nexus nature, it is important to consider both resources and target them simultaneously to prevent the system being under-designed.