Asked about ESP32 DevKit
How do I connect a relay module to 3.3 V logic?
Answer
Take a module with an optocoupler and check whether it is active-low or active-high. Power the relay coil from 5 V and the logic side from the ESP32, with a common ground. For mains loads use a certified module in an enclosure, or a solid-state relay, and never touch the circuit while it is powered.
Parts for this solution
AI-assisted answer, reviewed by a human. Not tested on every hardware revision.