user73081: I want to power ESP32 with 230V AC and I don’t know how to do it. The requirement is that it must never overheat. What components should i use? The ESP will be in small space with no airflow. Will it be even possible?

user71575: The folks over at Random Nerd Tutorials offer a solution for this exact scenario using a HLK-PM03 Hi-Link 100-240V AC to 3.3V 1A DC converter. They add electrical and thermal fuses to mitigate some of the possible failure modes of over-temperature or over-current.
The specifications of the HLK-PM03 are here. I suspect there will be a few alternatives available that do a similar function.
My suggestion is to be hyper-aware of the safety issues of dealing with mains power, and to be realistic about your own capabilities.

73081: <p>I want to power ESP32 with 230V AC and I don’t know how to do it. The requirement is that it must never overheat. What components should i use? The ESP will be in small space with no airflow. Will it be even possible?</p>
 71575: <p>The folks over at <a href="https://randomnerdtutorials.com/esp8266-hi-link-hlk-pm03/" rel="nofollow noreferrer">Random Nerd Tutorials</a> offer a solution for this exact scenario using a <a href="https://makeradvisor.com/tools/hi-link-hlk-pm03/" rel="nofollow noreferrer">HLK-PM03</a> Hi-Link 100-240V AC to 3.3V 1A DC converter. They add electrical and thermal fuses to mitigate some of the possible failure modes of over-temperature or over-current.</p>
<p>The specifications of the HLK-PM03 are <a href="http://www.hlktech.net/product_detail.php?ProId=59" rel="nofollow noreferrer">here</a>. I suspect there will be a few alternatives available that do a similar function.</p>
<p>My suggestion is to be hyper-aware of the safety issues of dealing with mains power, and to be realistic about your own capabilities.</p>
