Here's one of my projects, it all started with a video on Youtube from Makermeik of a wirless window transmitter, I took the circuit design and made it a lot smaller and had it made by JLCPCB.
This design uses a Li-Ion cell (4.2V) and has an LDO that powers the ESP, the ESP spends most of its time in Deep Sleep (20uA), when the reed switch opens or closes an edge triggered Monostable pulses the Enable input of the ESP waking it up and when it's finished transmitting it goes back into Deep Sleep.
With a 600mAh Cell you should get 2 years plus.
I also 3D printed an enclosure for it.
I have a GIT page for it here https://github.com/gadjet/Window-Door-Sensor-V3