Replacing shower valve cartridge; water supply
Shutting off the water line at the entrance to your home should be good enough for most instances.  

The only exception is if the water heater is above the location of the cartridge you are replacing; water might flow from the heater to your location.  To avoid burns, open a tap at a higher elevation and drain the line/tank or if you have shutoffs at the tank, close them.  If you are draining the tank, it would be best to turn off the gas or electricity to the heater to avoid damage to the tank and/or elements.

If you are still concerned, just turn off the tank.  Occasional shutoff to the water heater is not harmful.  But your tank should have a pressure relief valve to avoid over-pressure and damage.

Air in the waterlines is not harmful.  Open your taps and turn on the main and purge air from the system.  

If you shut off the water heater, only turn it back on after you have purged air from the waterlines.

No matter which procedure you took above, it is very likely you disturbed scale on the inside of the supply lines and it will cloud your water.  Let the taps run for a few minutes to purge this as well.

Related:
Is it safe to shut off cold water entering water heater?