UPS

If you live in an area with unreliable power, consider an uninterruptible power supply. It’ll gracefully shut your PC down if the lights go out.