Can it be done?
You can purchase a whole house generator. You would need an electrician to do the wiring connections. You would need a transfer switch hooked up to the main electrical panel that would kick in when there's a power outage. A plumber if natural gas powered to connect the gas line. Do a Google search and see all the different generator applications and hookups. Too many options to list here. There are some that are DIY but very limited. You may find something your capable of doing. A stand alone gasoline generator that you turn on during a power outage using extension cords to power important appliances and utilities.
Yes, you’re going to want to be able to prioritize which items have access to the generator when it’s in emergency mode. A small portable unit will give you 1-2 outlets, and so that’s the refrigerator & an emergency HVAC unit. That’s it.
If you want to have a lot of your house, being able to access this emergency generator, then
This is where you absolutely must get a professional experienced electrician involved - dedicated circuits in an existing condition.
Big generators require sound isolation.
They also require exhaust/fumes isolation. They need to be on a well draining concrete pad with leveling feet,
If you plan on putting it in a shed, and then running cables to the house, then you’ll need to have the electrician calculate the impedance or Ohms in the cable “run”.
We’re also talking about a separate DC/AC inverter, for a big unit.