There are two ways of doing this:
1. A 12V supply from a 'leisure battery' and a mains powered charger
2. A mains powered 12V supply and a backup battery
Like @Robbo3 and many others I use a mains powered 12V supply, but also have a small rechargeable battery. There's a module that senses if...