The hybrid small grid system is a solution to many economic and environmental problems. The pre-feasibility of the project is a necessary step to validate the implementation of any project. Microgrid hybrid systems (consisting of PV, wind turbines, diesel generators, and battery storage) were examined in two countries to determine their optimal economic and size. In this paper, the technical-economic was implemented as an objective function based on net present cost NPC, with respecting many constraints such as LPSP, availability, and the renewable fraction. The optimization performed using a smart and efficient algorithm called the PSO algorithm. The results indicate that the building of a microgrid hybrid system in Baghdad is more economical compared to Rabat with the same corresponding components of renewable energies and load capacity. The resulting total showed that the cost of the project reached 31K dollars for the city of Baghdad, while the cost touched 43K dollars for the city of Rabat.