Types
Many companies make generators for home use to power a house in the event of a power failure. There are also generators that can be built in to switch on automatically when the power goes off. Some can be configured to run on natural gas supplied to the home from a utility.
Considerations
You could, in theory, live off generators in your home, but the costs would probably make it not worth the effort. You would have to add several gallons of gas or diesel fuel several times a day, which could get costly. Also, generators are not designed to be run constantly over a long period, so you would have to get a new one often.
Warning
It can be complicated hooking up a generator to your home. It is advisable to have an electrician do it or at least set it up. There are precautions that need to be taken and serious injury and fires can result if the generator is not hooked up properly.
Legalities
In most cases, there is no law requiring you even have electricity. Some cities require it, but there are many rural areas where electricity is not available. Some people are using wind and solar energy, and in some cases have more than they need.