Do you know which aspect is getting flaky? Ie. Is the wifi dropping out temporarily, or permanently, or the whole MCU locking up, or the 3.3V browning out, or…?
I'm not entirely sure, I can't debug because I don't have a serial interface to it. The board just stops responding to MQTT commands. I do see a lot of "connecting to MQTT" debug messages over the network, so I assume it does have WiFi. I should try pinging and see if it disconnects.
There’s your first lesson: Always have a debug header with serial pins on your board. ;) It should be easy enough to solder some wires onto the ESP32’s serial port… although wait, how are you programming it?
It’s also good to have a couple of status LEDs and a power indicator on any custom board. Then you can add blink codes to indicate errors etc.