The global crisis associated with COVID-19 and the Russia-Ukraine conflict has affected progress towards the Sustainable Development Goals (SDGs). Projections for SDG7 (Ensure access to affordable, reliable, sustainable, and modern energy for all) indicate a slowdown in the pace of electrification. Thus, the problem of poverty will persist in many regions as long as access to electricity remains difficult. This work analyzes some solutions to the lack of electricity supply in a rural community using organic waste from its economic activity and the integration of other available renewable sources to make electricity affordable and reliable. A model that minimizes the levelized cost of energy and restricts the proportion of annual energy not supplied to less than 5% of the community’s annual demand optimizes the performance of off-grid and on-grid systems. These systems have in common the production of electricity from biogas produced from swine manure, supplemented with wind and solar generation. Batteries and diesel generators support the operation of off-grid systems. As expected, the grid-connected system presented the best performance; however, the result reaffirms the need for governments to ensure the policy and infrastructure conditions that facilitate the grid connection of vulnerable communities to achieve SDG7.